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
2,206,149
questions
1
vote
1
answer
19
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
1
answer
9
views
Python WFDB library has no attribute ann2rr
I am trying to extract RR interval data from ecg annotation files from physionet by using the ann2rr function according to documentation:
from IPython.display import display
import matplotlib.pyplot ...
0
votes
0
answers
14
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-...
0
votes
0
answers
7
views
Azure Synapse: How to get notebook magic command %pip to work in a pipeline
When running %pip install in my Synapse notebook manually, it works as intended, without any problems.
However, when I try to run that same notebook in a pipeline, I get:
{
"errorCode": &...
0
votes
2
answers
1k
views
'keras.api._v2.keras' has no attribute 'mnist'
I tried installing TensorFlow and I wanted to try something I saw on youtube.com but I've tried multiple things nothing worked for me and every time I got different error.`
import tensorflow as tf
...
0
votes
0
answers
18
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() ...
2
votes
1
answer
28
views
Adding a flag to the end of a bar chart in python
I was trying to follow an example outlined here https://stackoverflow.com/a/61973946
The code, after small adjustments looks like this:
def pos_image(x, y, pays, haut):
pays = countries.get(pays)....
0
votes
0
answers
34
views
How to Use a Single INSERT INTO Statement for Multiple Rows in Python?
I’m currently working on a Discord Python bot where I loop through a list of ForumTags and generate an INSERT INTO SQL statement for each object to insert data into a MySQL database.
However, I want ...
-3
votes
1
answer
52
views
How do I make python give me the right solutions for a function and change the format of the zeros based on the sign?
I am trying to make a quadratic formula calculator. Everything seems fine, however, when I put in some functions, like x^2-2x+1 and x^2+2x+1, it gives me the same zeroes for them when they have ...
0
votes
0
answers
4
views
Calling module from jupyter notebook inside of poetry project reults in 'No module named' error
I'm working on a module with poetry with a directory structure like
./
/my_module
(module files)
/tests
test_thing.py
/jupyter
demo.ipynb
In the test files and jupyter ...
0
votes
2
answers
240
views
How to type hint a dict from classes to instances?
I've got a dict that maps classes to instances of those classes. How can I type-hint this in Python 3?
from typing import Dict
d : Dict[???, ???] = {}
d[int] = 0
d[str] = "hello world"
0
votes
2
answers
34
views
Django where to store model-level variables
So I have my model:
from django.db import models
x_default_coordinate = 0
y_default_coordinate = 0
class MyModel(models.Model):
location1 = gis_models.PointField(
srid=4326, default=Point(...
5
votes
10
answers
47k
views
Python: Finding Longest/Shortest Words In a List and Calling Them in a Function
I have a list of words:
words=["alpha","omega","up","down","over","under","purple","red","blue","green"]
I have two functions that are supposed to find the shortest and longest words in this ...
0
votes
1
answer
15
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
...