topskill.dev
CoursesTracks
0
All courses/Introduction to Pandas: Community Data DeskAssemble the market report
8. Build a Market Report
10 / 12
← 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

Assemble the market report

Each stage is now written. Give the coordinator one function that runs them in order for new input sheets. The completed helpers stay above build_report in main.py; reuse them rather than repeating their code.

Start by unpacking read_tables into sales and stalls. Pass sales through cleaning, enrichment, and selection. The directory waits until attach_stalls, where it joins the selected rows. Then group and export. Local names for each intermediate table make it easier to inspect a stage if the result is surprising.

The audit helper remains available for inspecting joined rows, but this function returns only CSV text. Do not put the audit dictionary into the CSV or save a file.

Implement build_report, then Run. With Walk-in sales of at least 4, the sample produces North 3.0,7.5 and South 4.0,16.0. Submit changes the sheets, channel, and threshold and checks that the helpers receive each other's results.

Your Task

  1. Implement build_report(sales_text, stalls_text, channel, min_revenue) by calling the supplied import → clean → enrich → select → attach → group → export functions in order, returning the final CSV string.
Hint 1
1 / 1
HINT 1

Keep stalls from read_tables for attach_stalls; pass each other result into the next helper.

Files
  • ⋄main.py
Loading editor…
Press Run to execute your code.