Explain This Pandas Code Line by Line
Understand inherited code before changing it.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
Explain the pandas code below to me as a patient colleague would. Code: [PASTE_CODE]. My level: [MY_LEVEL]. What I think the code does: [MY_GUESS]. For each statement give: what it does in plain words; the shape and dtype of the data after it (give an example with three invented rows when helpful); the pandas concept behind it with a one-line definition; and anything risky (chained assignment, SettingWithCopyWarning, inplace operations, index alignment, implicit type conversion). Then provide: a diagram in text of the data flow from input to output; a list of assumptions the code makes about its input (column names, types, uniqueness, no nulls); three inputs that would break it with the error each would raise; and a refactor into smaller named steps with a pipe chain. Compare my guess with what the code really does and point out where I was wrong. Finish with two exercises that change the code slightly so I can test my understanding.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.