This exercise simulates what TAs will do with students in the Data Science Clinic:
review real code, identify high-value improvements, and give constructive feedback.
bad_script.py.pandas are available.Time limit: 5 minutes.
High-value points (examples below — you don’t need all of them, just 3–5 solid picks):
__main__ guard so imports don’t execute I/O.print with logging at appropriate levels.groups=[]).except Exception; catch specific errors.inplace=True and chained assignment pitfalls.Pathlib for file paths.DataFrame.to_json instead of json.dumps.bad_script.py — intentionally flawed version.reference_solution.py — revised version illustrating best practices.