Category "python"

Define a function with a fractional power in python

I want to defining the following function: def f(x,y): return pow(x, 1/3) + y x = np.linspace(-1, 1, 10) y = np.linspace(-1, 1, 10) X, Y = np.meshgrid(x,

Python Screenshot as file with errors

I'm running python 3.10.4, I'm trying to take a screenshot and I received this error: [15468:20292:0409/154343.065:ERROR:fallback_task_provider.cc(124)] Every r

Read multiple serial port at one time using python

I'm trying to read out multiple serial ports at the same time with Python. I found some code to make it, but its not going well. The code not read the serial pr

Numpy indices in quadrilateral

Is there a smart way to get the indices of all the entries within four points? In particular this is about the case where I have four points (x_1, y_1), (x_1, y

String as a condition in a filter

In my program, I want the user to be able to pass a string as a condition. For example, if the user input is "col(X) | col(Y)", I would like this string to be t

Python3.8 Pip Distutils.cmd Not Found

I was trying to have a virtualenv set up where it is at python 3.8 while my system is at a more recent version. I have figured out how to create the venv but no

Airflow SimpleHttpOperator is not pushing to xcom

I have the following SimpleHttpOperator inside my dag: extracting_user = SimpleHttpOperator( task_id='extracting_user', http_conn_id='user_api',

I keep getting this error for the colorgram module in Python

I keep getting this error when I am working with colorgram: Module 'colorgram' has no 'extract' member Here is my code so far: import colorgram colors = colo

Permission Error: [Errno 13] Permission denied: 'traccert/tesseract.exe' while run our flask application

When I run the application on local host, its working fine, but when I run the application on heroku and try to convert the image to text its show an error. You

numpy where with multiple conditions linked to dataframe

I'm using numpy where with multiple conditions to assign a category based on a text string a transaction description. Part of the code is below `import numpy as

Fastest/ most efficient way to trigger an if statement if specific numbers are met

There are multiple ways to do this, but I'm looking for the fastest/ most efficient way. I've got a counter, starting at 0, which increments every time an event

Why is web scraping stock prices through beautiful soup returning a different price than the one on the Yahoo Finance page?

I am trying to write a program that will give me the stock price for a few different stocks, but when I run my program, it returns 116.71, while Yahoo Finance h

VSCode: how to interrupt a running Python test?

I'm using VSCode Test Explorer to run my Python unit tests. There was a bug in my code and my tested method never finishes. How do I interrupt my test? I can't

dataframe-image 0.1.1 does not export as image

The library dataframe_image is being used to convert a dataframe to png at spyder. However, it sends an error when the example code is executed. The error is: T

Widget appears after the user's input

I'm creating a GUI and I had an issue. My GUI is going to interact with the users, so depending on the user's input I want a button to appear. How can I do it?

How to make plotly.express.line lines not to connect between one another?

I am new to plotly and I am trying to draw some roads on a map in different colors based on the traffic value. This is what I tried: fig = px.line_mapbox(lat=te

Dividing each element of a python dataframe to a Series

I have a dataframe like below: import pandas as pd data1 = {"a":[1.,3.,5.,2.], "b":[4.,8.,3.,7.], "c":[5.,45.,67.,34]} data2 = {"a":[4., 6, 8] }

client side caching be able to write responses to the disk and fetch them from the disk when I get a cache hit

I need to add client side caching functionality to my client, I don't need to implement any replacement or validation policies.Just be able to write responses t

How to interpret PySurvival's predict_survival output?

I've built a model using PySurvival's CoxPH model and then ran the predict_survival function to check its output. Here's a sample of the output it provides when

python selenium scraping a betting site

I recently started coding a program with python selenium. The goal of the project is to calculate arbitrage possibilitys between two sport bookies (but that doe