r/Python • u/A-Busi6711 • Apr 01 '26
Discussion Python optimization
I’m working on a Python pipeline with two quite different parts.
The first part is typical tabular data processing: joins, aggregations, cumulative calculations, and similar transformations.
The second part is sequential/recursive: within each time-ordered group, some values for the current row depend on the results computed for the previous week’s row. So this is not a purely vectorizable row-independent problem.
I’m not looking for code-specific debugging, but rather for architectural advice on the best way to handle this kind of workload efficiently
I’d like to improve performance, but I don’t want to start by assuming there is only one correct solution.
My question is: for a problem like this, which approaches or frameworks would you recommend evaluating?
I must use Python
6
u/commandlineluser Apr 01 '26
numbais commonly used for part 2.You just write regular "for loops" and it will be compiled into machine code.
https://pypi.org/project/numba/
https://numba.readthedocs.io/en/stable/user/5minguide.html
But it may depend on what you choose for part 1.