All Questions
Tagged with performance python
10,040
questions
0
votes
1
answer
25
views
K Means taking a long time to run
I have a dataset that has 3 million records with 15 columns that I'm using for customer segmentation.
I've used KMeans and MiniBatchKMeans but it's running even after 45 hours (did not run them ...
0
votes
0
answers
11
views
Turn off Azure Telemetry when param debug==True
Question of code quality:
Is there a better way to implement a separate debug flow/turn off opentelemetry for a FastAPI endpoint in Python rather than separating the functionality (separate function) ...
-2
votes
0
answers
27
views
Quickly computing primes with python [duplicate]
I was solving this problem in Project Euler which asks for finding the 10,001st prime.
Here's what I did:
def is_prime(x):
local_list = [i for i in range(1, x+1) if x % i == 0]
if len(...
1
vote
2
answers
72
views
How can I efficiently filter and aggregate data in a Pandas DataFrame with multiple conditions?
I have a large Pandas DataFrame with multiple columns, including Category, SubCategory, Value, and Date. I need to filter this DataFrame based on multiple conditions and then aggregate the filtered ...
0
votes
2
answers
54
views
Why is the last digit incorrect in my timing attack password cracker using Python?
I'm working on a timing attack to crack a password using Python. My goal is to measure the time it takes to check each digit of the password and use this information to deduce the correct digits. The ...
-2
votes
0
answers
22
views
How to Retrieve Full Text from Another Open Window Using Python Without OCR?
I'm working on a Python project where I need to programmatically retrieve the full text content of another open window on my Windows machine. I need to avoid using screen capture followed by OCR ...
-2
votes
1
answer
67
views
Making Python code faster for large data sets
I am solving a problem on HackerEarth (full text can be found here):
Bob has a playlist of songs, each song has a singer associated with it (denoted by an integer)
Favourite singer of Bob is the one ...
1
vote
2
answers
101
views
Optimizing Python Code faster that 4 seconds
I have written some code to solve an online problem, Here.
mustConstraint = set()
notConstraint = set()
violated = 0
satisfied = 0
for i in range(0, int(input(''))):
constraint = input('')
...
0
votes
1
answer
42
views
Efficiency of Redis compared to relational DBs in Python
My data contains of 6mln rows with such columns:
'primary_key', 'timestamp', 'temperature_value','sensor_id', 'sensor_status'
e.g.
1, 2023-01-01 00:00:00.0, 20.28, 1, GOOD
The data was written to ...
0
votes
0
answers
36
views
General Suggestions for improving my python programm [closed]
I recently started going through the problems over at ProjectEuler, and I wrote some code for one of the problems-9- that I think is decent?
def mainline():
for a in range(0,999+1):
for b ...
0
votes
0
answers
23
views
Why is my IDF Python code running much slower than pyspark
I am creating IDF values and my python code runs much slower compared to the pyspark implementation (2+ hours for mine versus seconds) and I am interested why that is so. I know pyspark is Java based, ...
0
votes
0
answers
17
views
When using `matplotlib.animation` and 'LineCollection`, how to reduce the size of the colors list
I am continuously plotting data using matplotlib.animation with multiple subplots that use a lot of segments. The issue I am running into is that size of the colors list is quite large ['Blue','Blue',....
1
vote
0
answers
72
views
Is Decimal a lot slower in MacOS Swift than Decimal in Python?
[update]fyi: I did try running the same test below with GMP lib in Swift and it is about 10x faster than Swift Decimal which I imagine the upper bound would be. Still confused why Python Decimal would ...
7
votes
2
answers
116
views
Do Python coders have a bias towards list over tuple? [closed]
Basic Facts
Lists are mutable (supporting inserts, appending etc.), Tuples are not
Tuples are more memory efficient, and faster to iterate over
So it would seem their use-cases are clear. ...
0
votes
0
answers
71
views
Keras training speed with PyTorch backend is a lot slower than with TensorFlow
I am on native Windows and I used old Keras with TensorFlow 2.10 (GPU accelerated) before. I wanted to try Keras 3 with PyTorch backend.
Can someone please help me why this model trains 10x slower ...