Quantcast
Channel: Active questions tagged python - Stack Overflow
↧

Image may be NSFW.
Clik here to view.

How to change the font color or highlight a string in between to asterisks in...

My df has 19 columns but for simplicity the df will have the following columns [['Gene_name','Genes_in_same_transcription_unit']]The column 'Gene_name' list a bunch of genes in E. coli and the...

View Article


Using `setattr` to decorate functions from another module

I'm having trouble applying a decorator to an imported function. Suppose I have the following foo.py module:# contents of foo.pydef bar(): return "hello"I now want to import bar from it and apply the...

View Article


is this tutorial ->"Running Airflow in Docker" still working? [closed]

I've followed this tutorial and I could run everything and airflow is running, ok, but if I try to create a new dag (inside the dags folder)├───dags│└───__pycache__├───plugins├───config└───logsls...

View Article

why am i getting the error "TypeError: 'type' object is not subscriptable"...

p = Player()p.name = raw_input[str["What is your character's name? "]]print ("(type help to get a list of actions)\n")print ("%s enters a dark cave, searching for adventure." % p.name)

View Article

How to apply multiple methods sequentially to class arguments

I have a class which takes two arguments. I want to apply these two arguments to different methods. The output of each method should serve as the input for the next method. Additionally, I want this to...

View Article


UUID('...') is not JSON serializable

I get this error when i try to pass the UUID attribute to url parameter.urlpatterns = [ url(r'^historia-clinica/(?P<uuid>[W\d\-]+)/$', ClinicHistoryDetail.as_view(), name='...'),]views.pyclass...

View Article

How to convert rows to columns in a Pandas groupby?

I have a table containing price data for a set of products over 6 months. Each product has a unique id (sku_id) and can be from size 6-12. We measured the price each day, and generated a table similar...

View Article

Hyperparameter Optimisation

Im trying to forecast a time series using prophet model in python, for which I would like to find the optimal tuning parameters (like changepoint_range, changepoint_prior_scale,...

View Article


AttributeError When Updating Learning Rate in Keras Using K.set_value

I'm trying to update the learning rate of my Keras model dynamically during training. I'm using the following code:import tensorflow as tffrom tensorflow.keras import backend as Kmodel =...

View Article


Can't hear Librosa chirp

I am using python under VS.When running the following codeimport librosafrom IPython.display import Audiosr = 22050y_sweep = librosa.chirp(fmin=librosa.note_to_hz('C3'), fmax=librosa.note_to_hz('C5'),...

View Article

Why are images from my custom RTP-to-JPEG decoder distorted, while OpenCV...

I am working with an Ethernet camera that streams images via an RTSP stream. The camera supports PTP (Precision Time Protocol) and writes the PTP timestamp in the header extension of the RTP header....

View Article

JWT Token Expiration Handling Causing 500 Error in Flask-JWT-Extended and...

Problem:I'm building a Flask backend using flask-restful, flask-jwt-extended, and PostgreSQL. When testing JWT token expiration via Postman, expired tokens consistently result in a 500 Internal Server...

View Article

How to automatically log users out of web application using firebase? [closed]

I'm working on a web application with backend made in python + fastapi and firebase, and my client asked me to create a function to automatically logoff any user using the plataform after 23:55, what...

View Article


What does this Error mean in context of anomalies patchcore model

Hello Im trying to use Anomalib to train Patchcore model on MvTec dataset but somehow I get a error when starting training that says:IndexError: Dimension out of range (expected to be in range of [-1,...

View Article

Issue with Django User Registration: "An error occurred. Please try again."

I am trying to implement user registration and login in my Django project using AJAX. However, even when I enter all the information correctly, I keep getting the error message:"An error occurred....

View Article


Image may be NSFW.
Clik here to view.

Paramiko, Python, Windows : How to connect to a remote computer and from...

I've seen several questions and answers related to this topic but I've been unable to grasp the howto.What I'm able to do : connect to a remote computer using a Python script using Paramiko and return...

View Article

Getting a pyarrow.lib.ArrowInvalid: Column 1 named type expected length 44...

I am getting the below error when trying to modify, chunk and resave a Huggingface Dataset.I was wondering if anyone might be able to help?Traceback (most recent call last): File...

View Article


How to inherit DBT source documentation in the models

I have multiple DBT models that read from the same source database, and despite having written documentation (descriptions, tests, etc) for the source database, none of the columns descriptions carry...

View Article

Image may be NSFW.
Clik here to view.

Can't install numpy with PyPy 7.3.19

I'm trying to install numpy (2.2.3) with PyPy 7.3.19 (Python 3.11.11). I'm using PyPy in a .venv folder. While the venv is active, I've tried running these commands:python -m pip install numpypip...

View Article

Saving and Loaded Images for Tensorflow Lite

Planning on implementing Tensorflow Lite for image classification.To test the model, using Fashion-MNIST database to create the model following a Tensorflow basic example from their website. Created...

View Article

How to automate the generation of certificates through certbot?

How can you automate this process with Python's FastAPI for a convenient call from another server, how can I do this?I tried to do it with subprocess.run and Popen, but nothing happened. The...

View Article


How to restream IPTV playlist with Nginx RTMP, FFmpeg, and Python without...

I have an IPTV playlist from a provider that allows only one user to connect and watch. I want to restream this playlist through my own server without recording it and in a lightweight manner. I’m...

View Article


Selenium script for Amazon UK postcode entry triggers CAPTCHA and fails to...

Automating Amazon UK with Selenium: Handling CAPTCHA, Setting Postcode, and Extracting Product DataI'm automating Amazon UK (www.amazon.co.uk) using Selenium to:Decline cookies (if present).Click the...

View Article

Inconsistent results with PyTorch DeepLabV3 model even after fixing random seeds

I encountered non-deterministic behavior when using PyTorch's DeepLabV3 model with pretrained weights. Despite fixing all random seeds, repeated executions still produce different results.Code for...

View Article

How to remove outliers from each group with in Python [closed]

I have dataframe df with columns house_price, no_bedrooms and house_type. I want to groupby based on house_type and remove outliers based on house_type. For example outlier in flats, outliers in...

View Article


GPU usage Tensorflow and CUDA compatability

I'm trying to train a Tensorflow model on a GPU, but I've been struggling to get it running.Essentially, I'm using a high-performance computer cluster and submit jobs using bash and slurm-files.My...

View Article

Why does Python pass an instance to a class attribute that is a function?

I define a class attribute and give it a function. When I call this function, the instance is passed on as the first argument (as if it's an instance function call with a self).I would not expect an...

View Article

Python with directory to exe

I'm searching a way to convert a python file into an exe. I want to convert the Python file including a few folders to a msiI already tried out Advanced Installers and the Pythoninstaller libary but...

View Article

Image may be NSFW.
Clik here to view.

Optimization of LEDs for uniform light on surface

So I have this problem where i want to make a pattern of LEDs such that the most uniform light is achieved within an area on a plane 5cm away. I can't change the power of the LEDs individually and I...

View Article



Reshape 4D array to 2D

I have the arrayimport numpy as npa1 = [["a1", "a2"], ["a3", "a4"], ["a5", "a6"], ["a7", "a8"]]b1 = [["b1", "b2"], ["b3", "b4"], ["b5", "b6"], ["b7","b8"]]c1 = [["c1", "c2"], ["c3", "c4"], ["c5",...

View Article


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>