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
481
questions
-1
votes
0
answers
21
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
18
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
27
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
11
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
16
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
43
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
22
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(...
1
vote
1
answer
39
views
for j in os.system("ls *.out") Doesn't iterate. Changing the name of files depending on extension [duplicate]
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
1
answer
43
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
0
answers
32
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 ...
1
vote
1
answer
24
views
Maximizing sum of signed numbers by not skipping more than one consecutive value: DP goes wrong
I am trying to solve this code challenge:
A user maintains a list of negative and positive ratings for movies in a collection. The user wants to choose some subsequence of movies from the collection ...
1
vote
1
answer
8
views
How to add trigger for run dag into another dag (with decorators) in Airflow?
I got 2 dags in same dags folder:
dag_update_database (dag_update_database.py)
dag_add_client_loyalty (dag_updade_clients_loyalty.py)
I need run second dag right after successfully run first dag.
I'...
0
votes
0
answers
19
views
Can't get form elements to align properly using pymupdf and reportlab
I'm writing a program that takes form files and turns them into interactive PDF forms by using markers to locate and draw form elements.
I've gotten my radio buttons to align on the page properly but ...
0
votes
0
answers
25
views
Python griddata() and Matlab griddata(): different results at some grid points
While converting some (pretty big physics) Matlab code to Python, I have stumbled upon this situation. Python/Scipy's griddata() function gives different results than Matlab's counterpart griddata() ...
1
vote
1
answer
24
views
TypeError: the first argument must be callable - self.job_func = functools.partial(job_func, *args, **kwargs)
I seem to be experiencing an issue with the following Python Scheduler tasks. I have the below code which has a function to refresh all workbooks in a set bunch of directories. I have attempted to ...