FreeCampus Python

Unit Challenge: Audit a Community Reading Log

Clean and summarize a reading log while making exclusions and assumptions visible.
Open in Colab
  • Goal: Clean and summarize a reading log while making exclusions and assumptions visible.
  • Estimated time: 60–120 minutes of active work.
  • Before starting: Complete the unit lessons.
  • Keep: Your source, observed outputs, checks, and a debugging note.

This community challenge is ungraded. Use the checks to review your own work; there is no submission service or automatic grade. Completion is self-reported in this browser on this device.

1. Audit a community reading log

Build a pandas DataFrame from the supplied reading sessions. Deduplicate identical rows; reject missing or negative minutes with reasons. Group valid sessions by club and report count and total minutes. Plot total minutes. Do not infer individual habits from aggregate records.

Predict an ordinary result before coding. Start with the smallest part you can run and inspect. Use Colab for notebooks and the local workspace introduced in the units for packaging or command-line tasks.

2. Set up the experiment

import pandas as pd

rows = [("A", 20), ("A", 30), ("B", 10), ("B", None), ("A", 20), ("B", -5)]
log = pd.DataFrame(rows, columns=["club", "minutes"])
# Audit, clean, summarize, and plot.

The starter is deliberately incomplete. Implement the contract; do not change the expected results to match an incorrect implementation.

3. Check the observable results

  1. Six source rows minus one duplicate and two invalid rows leave three sessions.
  2. Club A has two sessions and 50 minutes; B has one session and 10 minutes.
  3. An audit table reconciles accepted, duplicate, and rejected counts to six.
  4. Label the plot and distinguish total minutes from typical session duration.

Record actual outputs beside predictions. Reduce a failure to a small example, change one cause at a time, and repeat the failed check after repairing it.

4. Change one condition

Add a valid zero-minute session for B. There are now four valid sessions, but B still totals 10 minutes. Explain why zero is not missing and why the average changes.

5. Review a hint after attempting the task

Hint: connect the relevant tools

Inspect duplicates and missingness before filtering. Use explicit masks, retain the source, and label exclusions before aggregating.

6. Explain and self-review

Include source rows, cleaning policy, audit counts, summary, plot, and a limited conclusion. Discuss the assumption that identical rows are duplicates: real sessions can share the same values.

Review path: compare your result with the contract

Check the ordinary result first, then the boundary cases and changed condition. Explain which rule justifies each result. An implementation that differs from the hint can still satisfy the contract; explain why yours does.

7. Save your work and record completion

Save the notebook or project somewhere you control. Include one decision, one failed check, its repair, and a result you can reproduce. Record completion after reviewing the checks; you can undo it later.

Not yet recorded.

Return to the unit overview.

Back to top