Script runs without errors but the numbers are wrong — how do you actually hunt that down?
It reads about 4000 rows, does some filtering and grouping, and the totals are roughly ten percent off what I get doing it by hand for a small sample. No exception, no warning, just wrong. I have been adding print statements semi-randomly for two hours and I am clearly doing this badly, so I want to know what an actual method looks like.
@row_level_sam · 2w ago · 2 replies
Learn breakpoint(). Put it on the line before the suspect calculation, run the script normally, and you land in a prompt where you can inspect any variable, step one line at a time and evaluate expressions against the real state. Four commands get you almost everywhere: n for next line, s to step into a call, c to continue, and p to print an expression. Twenty minutes to learn it, and it replaces the entire print-and-rerun cycle you are stuck in.
Reply
Report
@darning_dee · 2w ago
The underrated part is that you can call functions from that prompt with the actual data loaded, which is how you test a fix before writing it.
Reply
Report