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,204,495
questions
0
votes
0
answers
2
views
Identify problem in the post request in html
I am working on a Flask application that manages therapy sessions for children. Each session can have multiple goals, and I recently updated my models and form handling. However, I'm encountering a ...
0
votes
0
answers
4
views
How can I move two items on a plot independently of each other?
I am making an image in python where I plot random points and use them to create 2 blobs. I then put a bounding box around them and scale them to be a target area. I then add a jitter to the 4 corners ...
0
votes
0
answers
8
views
Pyspark Regex Lookbehind Beginning Of String [duplicate]
My string in column "Key" is:
"+One+Two+Three-Four"
I want to extract all words following the "+" sign:
df.select(regexp_extract_all("Key", F.lit(r"(?<=...
0
votes
0
answers
10
views
Can not iterate "cbar" or "cmins" in multiple violinplot in a single plot
I am trying to change colors of each violinplot in multiple plots in a single plot. I can change colors of the bodies, but I can not change the colors for cbars, cmins, cmaxes. How do I do this?
...
0
votes
0
answers
7
views
How to Remove the "Series1" Label from a Pie Chart in "openpyxl" in Python?
I'm using openpyxl to create an Excel file that includes a pie chart. However, I can't seem to remove the default "Series1" label from the chart. I have included the entire export_to_excel ...
2
votes
0
answers
32
views
Why does re.compile exist?
Here is re.compile:
>>> import re, inspect
>>> print(inspect.getsource(re.compile))
def compile(pattern, flags=0):
"Compile a regular expression pattern, returning a Pattern ...
0
votes
0
answers
7
views
Gunicorn with Flask to produce Kafka message takes 20% cpu for one request
I'm building a testing tool to produce Kafka message using confluent-kafka library. I'm wrapping the producer with Flask to get value and key for each produce message from post body, so that from any ...
0
votes
3
answers
27
views
How can I downgrade the python in the terminal in visual studio code?
I have a piece of code I need to run but it is only compatible with tensorflow 1.3,1.4 and 1.5. I think I need to downgrade python in order to run this however the terminal has python 3.10
I have ...
0
votes
1
answer
26
views
Where to annotate python variables?
As I understand it, variables in Python work the same way as in Java. That is, when assigning, we bind a reference to the object to the right of the assignment to the variable (name) x in the current ...
0
votes
0
answers
6
views
JavascriptException Stale element not found after (multiple) redirects
I'm building a SeleniumBase scraper that takes a set of tasks and performs them on a website. After performing some actions on the site the script calls driver.execute_script("return window....
0
votes
0
answers
8
views
EMNIST not importing
So I was trying to import the emnist database but i'm not able to call the extract_training_samples. It keeps saying that the file is not a zip file. Im following the documentation given: https://pypi....
0
votes
2
answers
27
views
Inserting a column into a csv that pulls from the name of the file in python
I'm trying to insert a column of "StatementDate" into a csv, where the date is in the title of the csv. This is dynamic and will change week to week.
The formatting of the title is the same, ...
0
votes
0
answers
16
views
How to use a Rust type with no apparent conversions in Python
I am making a Rust based library for Python using Pyo3 and maturin which implements different cryptographic protocols, and I'm having trouble working with the following crate pqc_kyber_edit, as I need ...
0
votes
1
answer
34
views
I wrote a code to separate even and odd numbers, but I encountered this error?
while True:
num = input("pls type the number: ")
# check if it's int or string
number = int(num)
except ValueError:
print("error try again !!")
...
1
vote
1
answer
18
views
Is there any situation where re.search could not be used instead of re.match? [duplicate]
The documentation seems clear but it begs the question, what is the purpose of re.match? Couldn't re.search with the caret (^) be used instead as long as the MULTILINE flag is not enabled? Is re.match ...