Category "python"

Select all lines if occurence for one char in vscode

i'm going straight to the point; First of all i'm trying to select all lines if i find one char in common e.g: -"activit�" -"activit�s" -"actrice"

strongly different accuracy-values from model.evaluate(test_set) and from the sklearn classification_report

i'm experimenting on colab in image-classification with images of 32x32 pixels; i have 248 pics for training and 62 for testing (much too less, i know, but for

pytest (or unittest) not working when a source file has a dependency

I'm not sure why this is so difficult to get going, but I'm new to Python and I'm trying to get any unit test framework to run tests, but if I test a file that

Integrating streamlit with Docker not working

I am trying to integrate Streamlit with Docker. Means, I am trying to make a container where the python code is using streamlit. The app.py is: import streamlit

Simple Python code with weird list manipulation/comprehension technique by which one element of the list gets assigned to a variable

Today I was browsing through a coding website and found a simple code in Python which I was having a hard time to comprehend. Below is the exact code (with extr

Socket on docker

I have written 3 pyhton script working on local and connected with socket. I want to create docker containers for each script (one script = one container). But

Error: " 'float' object is not subscriptable" whenever I try to print certain values from a list of averafes

I created two variables that give the amount of words in a given context that are both positive and negative respectively within a couple of years. The followin

Open multiple xml files, and parse them

I need your help. I'm trying to read many xlm files from just one folder, and I need to extract some information of each xml. These xml have the same structure.

Problems installing lxml on M1 mac

So, I'm having the classic trouble install lxml. Initially I was just pip installing, but when I tried to free up memory using Element.clear() I was getting the

Copying from a range of cells with openpyxl, Error: Colors must be aRGB hex values

I am copying a range of cells with openpyxl from one workbook to another with the following code: import openpyxl import os #Current path path = os.path.dirnam

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"