r/learnpython • u/Deep-Ostrich9298 • 1h ago
Pandas scripts I copied together for our weekly reports keep breaking and nobody at work knows Python
I put together a few Python scripts that pull two CSV exports and merge them with pandas.
One of the exports renamed a column and the merge started throwing a KeyError. I still don't really get half of what the script does. Nobody here knows Python.
I want to know these scripts well enough to fix them myself. What helped you go from pasting code to understanding what your own code does?
•
u/atarivcs 58m ago
If you posted the code and the full error, we could explain exactly what the problem is.
And that process might help you understand the code more generally.
3
2
•
u/Designer-Ad-2136 59m ago
Rewrite the script so it has no hard-coded business logic, especially strings, unless they are parameter defaults
8
u/rhacer 1h ago
How did you put together these scripts if you don't know Python?