topskill.dev
CoursesTracks
0
All courses/Introduction to Pandas: Community Data DeskProject: prepare a market log
4. Make Messy Data Usable
12 / 13
← Introduction to Pandas: Community Data Desk
○A desk for labeled data○Import pandas for a stall card○Exercise: Make a count card○Read the default index○Exercise: Number the arrivals○Name the labels○Exercise: Label a shift○Pick a label or a position○Exercise: Find two counts○Add counts by label○Exercise: Combine two shifts✦Module Quiz
○Build a market table○Exercise: Assemble two tables○Inspect labels and dtypes○Exercise: Read the table card○Preview and summarize rows○Exercise: Check the new delivery○Select a column○Exercise: Pack a report view○Find a row and column○Exercise: Look up table cells○Add a calculated column○Exercise: Calculate market revenue✦Module Quiz
○Choose columns for a stall card○Exercise: make a vendor contact sheet○Find rows by label and position○Exercise: inspect two delivery windows○Filter stalls with a comparison mask○Exercise: shortlist ready orders○Combine two selection rules○Exercise: build two volunteer queues○Match a list of categories○Exercise: list invited workshop types○Order a stall leaderboard○Exercise: rank pickup points✦Module Quiz
○Spot missing records before filing○Exercise: audit delivery addresses○Fill an absent attendance count○Exercise: complete inspection ratings○Recognize repeated entries○Exercise: reconcile order revisions○Turn text counts into numbers○Exercise: repair case quantities○Standardize names and column labels○Exercise: standardize workshop registrations○Update selected rows safely●Project: prepare a market log✦Module Quiz
○Stack delivery sheets○Exercise: Stack visit logs○Align column notes○Exercise: Align fees○Merge on a named key○Exercise: Match payments○Guard against duplicate prices○Exercise: Validate badges○Join indexed areas○Exercise: Join fee bands○Mini project: Assemble the market ledger✦Module Quiz
○Count values and rows○Exercise: Summarize zone receipts○Profile values and labels○Exercise: Profile stall visits○Group on two labels○Exercise: Group shift totals○Name grouped results○Exercise: Name category measures○Return a baseline per row○Exercise: Compare visits to a group○Pivot a daily grid○Mini project: Publish the market summary✦Module Quiz
○Read a market CSV○Exercise: load inventory CSV○Parse dates while reading○Exercise: convert sign-up dates○Find the day with dt○Exercise: count visitors by weekday○Read JSON records○Exercise: load a JSON roster○Export CSV without an index○Exercise: round-trip a sales table○Sketch data with text bars○Exercise: chart item totals✦Module Quiz
○Warm-up: read a ticket sheet○Import the two market sheets○Clean the sale rows○Add revenue and sale day○Filter eligible sales○Attach the stall directory○Group neighborhood totals○Export a shareable CSV○Audit the reported rows○Assemble the market report○Exercise: compare two channels✦Module Quiz

Project: prepare a market log

The desk receives a log with padded seller names, text quantities, missing categories, and repeated visits. Build a small cleaning pipeline without overwriting that raw record. Each function accepts a table and returns a new one; the supplied print code connects them.

Order matters. Rename the seller header before selecting it. Clean names before comparing seller/day pairs, or MINA and Mina would count as different sellers. Convert units before dropping missing numbers, or "unknown" would still be ordinary text. For this log, valid counts are whole numbers.

After removing rows missing seller or units, fill only missing categories. Keep the last occurrence of each seller/day pair; input order represents revision order here, not sorted date order. Finally mark qualifying rows ready with one loc assignment on a copy. Leave other statuses, columns, and row labels alone. Empty text is not automatically missing.

Each function is checked separately on suitable input, so task 1 can pass before task 2 is written. The supplied Run pipeline waits for the seller header and numeric units before using them. At the end it should show only revised: seller mina, units 7, category veg, status ready. The raw first row is superseded and the unusable row has no numeric units.

This gives the desk a cleaned table ready for the next section, where separate tables will be combined.

Your Task

  1. Make rename_seller(frame) rename seller_name to seller.
  2. Make tidy_seller(frame) strip and lowercase the seller column.
  3. Make convert_units(frame) turn units into nullable Int64, coercing invalid text to missing.
  4. Make drop_incomplete(frame) discard rows missing either seller or units.
  5. Make fill_category(frame) replace missing category with unassigned.
  6. Make keep_latest(frame) retain the last record for each seller and day pair.
  7. Make mark_ready(frame, minimum) set status to ready for rows with units >= minimum using .loc on a copy.

Edit main.py, press Run to inspect the table, then Submit to check your work.

Hint 1
1 / 1
HINT 1

Work through the functions in order; keep a copy before replacing a column or assigning with loc.

Take the Quiz →
Files
  • ⋄main.py
Loading editor…
Press Run to execute your code.