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
464
questions
0
votes
0
answers
10
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
15
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
37
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
19
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
33
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
0
answers
35
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
26
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 ...
0
votes
0
answers
19
views
Matplotlib contour line without drawing
I am trying to compute the contour lines of a numpy NDarray.
However, I do not want to plot them but simply to do some analysis with the obtained lines.
So far I managed to get a very similar result ...
1
vote
1
answer
21
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
13
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
21
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
22
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 ...
0
votes
0
answers
15
views
How To Register Model For Admin Page in Core App?
I defined a model (File) in core app(uploader) and tried to register it for admin page but didnt work.
then i tried adding core apps name to installed_apps in setting . after that admin page shows ...
2
votes
0
answers
9
views
Method `new_page` of `BrowserContext` doesn`t work as expected in `Playwright`
I use playwright with pytest. Here are content of my coftest.py file and file with tests test_keplr.py. For some reason, method new_page works as expected in fixture context_use_args_async, but fails ...