r/learnpython • u/Deep-Ostrich9298 • 15m 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?
2
Upvotes
•
u/goldenfrogs17 12m ago
type the code
•
u/rhacer 9m ago
How did you put together these scripts if you don't know Python?
•
u/Bubbaluke 8m ago
Find where the old column name is, change it to the new column name
•
u/atarivcs 4m 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.
•
u/Designer-Ad-2136 5m ago
Rewrite the script so it has no hard-coded business logic, especially strings, unless they are parameter defaults