Category "python"

Is there any way instead of status_code to determine the request is true or false?

I'm using Python3 with BeautifulSoup. I want to scrape data for a few employees from a site, depending on their ID number. My code: for UID in range(201810000,2

How to crop and extract stamp from an image with OpenCV?

I am new to OpenCV. I have a "simple" image of a stamp that I have already processed a bit, as you can see in the code below. Now I have the problem of cropping

filling missing data in pandas data set

I have annual stock data and some of the years, datas are missing for the columns : at, ebit, lt , ni, re, wcap. How can I fill these missing slots with the dat

ValueError: shapes and not aligned: (dim 2) != 4 (dim 0)

I am currently working on a script that does some array manipulating and calculations for modeling. I am running into an error and unsure how to solve it. from

Loading large files into memory with Python

When doing work with large files and datasets (usually 1 or 2 gb+), the process is killed do to running out of RAM. What tools and methods are available to allo

Error when creating a django superuser with Heroku - FileNotFoundError

I'm trying to deploy a django application on Heroku, but when it comes to the part where I need to create a superuser, I get an error: Traceback (most recent ca

Remove and insert element to a specified indices in Numpy array

Suppose I have a numpy array from which I want to remove a specific element. # data = np.array([ 97 32 98 32 99 32 100 32 101]) # collect indices where th

Can't parse entities: unexpected end tag at byte offset 0

i dont known, pls help async def getcatalog(message: types.message): if catalog.find_one({"type": 0}) is None: await message.answer('К с

I can't locate my python path (but able to locate python3 path)

I'm currently using Mac Pro and downloaded python through brew install python for the latest version (though it downloaded 3.9.12 instead of 3.10.x). Also, whil

Select interpreter of docker container in the vscode

In vscode, we can install the python extension, then select the interpreter which we want, like python in the conda environment. So we can use "shift" + "enter"

Threadpool executor Need Suggestion on call function or some steps before call executor.submit

I have a parallel threadpool execution like below with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor: # Start the load operations

Error when observing on uniform with sampled parameters in PyMC

I’m new to PyMC and am trying to model a situation where you are rolling marbles at a wall and trying to find the block. The data is only for the values w

How to catch a FFMPEG exception with subprocess?

I'm doing some work on subtitles and some videos have 1 subtitle track, others have 2 subtitle tracks. For those that have 2, I use the 2nd one (index = 1). I'm

How to get the value of a python script I run through ssh

I am using 2 raspberry pi and each of them has a camera connected. I am trying to run, from the first pi, a script to get the video feed of the second one. And

Python 3 does not show the barchart

I am trying to make this bargraph appear in the python run screen. But for some reason, it does not show the graph on the screen. However, if I put this code on

Cannot get a file to be read into a list of stock tickers and then get yfinance data for each

I am trying to read a csv file into a dataframe and then iterate over each ticker to get some yahoo finance data, but I struggle with matching the right data ty

How to get colored legend with seaborn barplot

There is a problem with plt.legend in seaborn and matplotlib. What is wrong with it? I can't see the legend color. plt.figure(figsize=(30,10)) plt.xticks(rotati

Find differences between a set of csv files in folder 1 against a set of csv files in folder 2?

There are a number a files that need to be compared for differences in their rows; difference not as in subtraction but as in what values are different for each

How can you iterate through a tuple (str), then return a dictionary containing the keys (from the tuple) and the index of the keys as the values?

How can you iterate through a tuple (str), then return a dictionary containing the keys (from the tuple) and the index of the keys as the values? Input: tup = (

Am trying to launch in Cpanel, but am getting a Module not found error

enter image description hereI'm new to Cpanel and am trying to launch my python Django project, I think I've set up everything correctly but am getting this err