Category "python"

wkhtmltopdf-django dynamic template to render

Is there any way to generate a PDF dynamically, with content being fetched from the database? My goal is to allow my users to generate their own PDF design from

Tesseract doesn't recognize number

I'm deskewing an image containing a number using Projection profile based skew estimation algorithm and extracting it through OCR. In order to calculate the cor

Somehow an error is not being picked up by try... except

I am using a try... except loop to deal with opening a file that is updated throughout the day. Every now and then it would throw an error "pickle data is trunc

AWS: How to add tensorflow modules from EFS to Lambda function dependencies?

I'm trying to deploy my machine learning model to AWS Lambda function. I trained my model locally with Keras and got .h5 file. I zipped Tensorflow and Keras mod

Socket programming - Communication between server and client

I'm trying to learn about sockets and how to create a server and a client in python. While reading this great article from Real Python I had difficulties unders

Display text on point cloud vertex in pyrender/open3d

I am using SMPL demo code to display the SMPL-X mesh of a person. Instead of taking the default body joints, I need to select vertices corresponding to some oth

"ModuleNotFoundError: No module named 'rich'" even though I installed with pip

I'm trying to import the rich python module into my code, but I keep getting a 'ModuleNotFoundError' even thought I used pip install --user rich after getting t

How to resolve Key Error Exception when accessing dictionary key inside an if statement

I'm currently developing EV calculator using python and django. I get a key error exception when trying to access a dictionary key in an if statement inside a f

Using different instance of self as argument to method in python

I'm trying to create a method that takes self and another instance of the same method as its arguments, for example: class AClass(): def __init__(self

Iterate through pandas dataframe, select row by condition, when condition true, select a number of other rows, only containing unique values

I have a large (1M+) dataframe, something like Column A Column B Column C 0 'Aa' 'Ba' 14 1 'Ab' 'Bc' 24

How to scrape Trusted Shops?

I would appreciate your help on this scraping problem. I would like to scrape this site: https://www.trustedshops.de/bewertung/info_XDAD39B874C275A0751198C2510C

Iterate through pandas dataframe, select row by condition, when condition true, select a number of other rows, only containing unique values

I have a large (1M+) dataframe, something like Column A Column B Column C 0 'Aa' 'Ba' 14 1 'Ab' 'Bc' 24

Python docstring convention for private properties

Is it necessary to write a docstring for private properties? https://peps.python.org/pep-0008/ says that "Docstrings are not necessary for non-public methods, b

Discord.py bot not sending messages in a discord server but sends messages in DM's

I have a discord.py bot that when the command is sent through DM, it works. When the command is ran through a server, nothing happens. There is no errors or tra

'bytes' object has no attribute 'condition'

I am trying to stream my Rpi (zero) camera (v2.0) to HTML using cv2.VideoCapture. However, I am facing a lot of errors and I'm currently stuck on this one as th

How do I implement rank function for nearest values for a column in dataframe?

df.head(): run_time match_datetime country league home_team away_team 0 2021-08-07

docker discord.py ffmpeg.exe was not found

My code works on windows fine I'm just stumped on how to migrate it to my docker server for stability reasons and my old vm shit the bed. bellow is my main play

'bytes' object has no attribute 'condition'

I am trying to stream my Rpi (zero) camera (v2.0) to HTML using cv2.VideoCapture. However, I am facing a lot of errors and I'm currently stuck on this one as th

How can I get a variable valued current working directory (pwd) in powershell profile

I was trying to use anaconda as my Python virtual environment, and my virtual environment is stored in project directory. Manually, I need to use following comm

Why are orders in my trading algo not working? (QuantConnect algo)

I'm currently learning and trying to build my first algo which is a variation of an opening range break on the SPY. Would anyone know why my orders aren't worki