Questions tagged [python]
Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Note that Python 2 reached end-of-life on January 1st, 2020. For version-specific Python questions, add the version tag (e.g. [python-3.x] or [python-3.9]). When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.
python
456
questions
0
votes
0
answers
9
views
Using pymongo installed via virtualenv and Ansible returns an error
Since it's good practice to install pip modules in virtual environment, I have the following task in place:
- name: Install python packages
ansible.builtin.pip:
name:
- pymongo
...
0
votes
0
answers
15
views
What to do after cross validation?
After using cross-validation to see how a custom predictive function performs on unseen data, I applied to function to the original dataset, and the performance (based on coefficient of determination) ...
0
votes
0
answers
4
views
Unet from segmentation_models_pytorch stalling in training
I have been following a tutorial on training a segmentation model on a custom dataset, but it refuses to make any progrees in training the model.
This is my model setup
import ...
0
votes
1
answer
16
views
assign rank and maintain sequence across duplicates
I'm assigning an incremental rank based on a value, but need to assign the same rank to duplicate values and maintain the overall sequence.
Instead of this:
Value
Rank
400
1
500
2
175
3
250
4
...
0
votes
0
answers
7
views
Python async_playwright
Ich schreibe ein Programm was von der ilovemusic Website die Streams abspielen soll. Das funktioniert auch. Nur das Problem ist wenn ich die Scraper Klasse in der main.py aufrufe über scraper_task = ...
-1
votes
0
answers
15
views
auto-py-to-exe expected str, bytes or os.PathLike object, not NoneType
I'm using auto-py-to-exe to convert my django project in an exe file but I couldn´t:
Traceback (most recent call last): File "C:\Users\gerar\AppData\Local\Programs\Python\Python312\Lib\site-...
-1
votes
0
answers
10
views
pickle serialization not persisting after closing program
Ive made a program to track my barbell lifts. The code I've shown below is opening up a serialized pickle dictionary called users, and if users is empty it prompts the user to create a profile.
import ...
0
votes
0
answers
19
views
What is the most efficient way to multiprocess over a very large dataframe?
I have a large Dataframe that I need to do a lot of matching operations over, and in the past have always used the below method for doing it. However, the Dataframe that I am currently attempting to ...
0
votes
0
answers
9
views
hosting a flask app in AWS lambda with API requests from teams bot
I am trying to host a teams bot on AWS, the message endpoint is set to the api gateway from the lambda function. The goal is for it to just send "message" back, however upon testing it gives ...
0
votes
0
answers
14
views
Python: trying to access instance attributes in self.__setattr__
I was trying to create a dataclass with shorter aliases for longer fields. Since I wanted to be able to add new fields (with long and short names) without having to write a @property decorated "...
4
votes
2
answers
33
views
How do I categorize projects in a dataframe according to its title?
I have a dataframe where I want to categorize energy releated projects in 4 different topics according to its title.
For that I want to use pre-defined keywords to identify which topic the project ...
0
votes
1
answer
18
views
Why does my Pydantic model contain an extra attribute when popupated from an object with extra=ignore?
The title says it all:
Why does my Pydantic model contain an extra attribute when popupated from an object with extra=ignore?
from pydantic import BaseModel, ConfigDict
# pydantic 2.4.2
class Test(...
2
votes
1
answer
31
views
for j in os.system("ls *.out") Doesn't iterate. Changing the name of files depending on extension
I am trying to write a script that will help me run a model several times changing the input of one value of the input files. The model over writes the output files so I need to rename the outputs ...
0
votes
0
answers
34
views
Column value lookup based on multiple conditions and wild cards
I have a dataframe:
df = pl.DataFrame({'Col1': ['a', 'a', 'a', 'b', 'b', 'b', 'b', 'aa', 'aa', 'aa']
, 'Col2': ['c', 'd', 'e', 'c', 'd', 'e', 'f', 'd', 'e', 'f']
,...
1
vote
1
answer
23
views
Attempting to put data from database onto dashboard in Django
So I am following this guide: https://www.youtube.com/watch?v=_sWgionzDoM and am at around 55 mins so far
I have the login stuff all working however I am unable to get the dashboard to show my data ...