Normalise by customers before you map a region

short · 35 min · Objective 4.1

Task

Before shading a map of the four regions, calculate what the shading would show -- raw order counts, or orders and revenue per customer -- and see whether the two maps would tell the same story.

Steps

  1. Count the customers in each region in data/customers.csv, and the valid orders and their net revenue per region.
  2. Save lab/map/regions.csv with header region,customers,orders,orders_per_customer,revenue_per_customer, the two rates to two decimal places.
  3. Record in lab/map/leaders.txt the lines most orders: REGION, most orders per customer: REGION and most revenue per customer: REGION.

Verify

These checks run in a POSIX shell with Python 3: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. On Windows, python3 is often a Microsoft Store placeholder that prints “Python was not found”; run alias python3=py in Git Bash first.

awk -F, 'NR>1 {print $1": "$2" customers, "$3" orders, "$4" per customer, "$5" revenue per customer"}' lab/map/regions.csv
grep -E '^most ' lab/map/leaders.txt

South has the most orders, 519, but West -- with the fewest customers, 67 -- leads on both rates: 6.87 orders and 1697.38 of revenue per customer. A map shaded by raw counts would make South darkest; shaded by rate, West. Counts mostly map where the customers are, so normalise before you shade.

This is an independent study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.