Start with a data question
Turn a broad curiosity into a question data can answer, and learn the workflow and vocabulary of data science.
- State a specific, measurable question
- Identify the unit of observation and the variables
- Tell numeric and categorical variables apart
Data science combines programming, statistics and knowledge of a domain to answer questions with data. Most projects loop through the same steps:
- Ask a specific question.
- Get the data - and learn how it was collected.
- Clean it: fix types, missing values, duplicates.
- Explore: summarize and visualize.
- Model or test: estimate relationships and uncertainty.
- Communicate what the evidence supports - and what it doesn’t.
It starts with the question. “How’s our bike-share doing?” is a mood. “Did the median weekday trip length change between March and April this year?” is a question data can answer: it names the outcome (trip length), the group (weekday trips) and the period.
Rows, columns and variable types
In a table, each row is one unit of observation - one trip, one customer, one day - and each column is a variable measured on it. Variables come in kinds, and the kind decides which summaries make sense:
| Kind | Example | Sensible summaries |
|---|---|---|
| Numeric, continuous | trip minutes, temperature | mean, median, spread |
| Numeric, discrete (counts) | bikes at a station | mean, median, totals |
| Categorical, nominal | mode: bus / bike / walk | counts, shares |
| Categorical, ordinal | rating: poor < ok < great | counts, median category |
Watch out for numbers that aren’t quantities: a ZIP code or trip ID is a label - averaging them is meaningless.
Try it
Up to 15 XPWhat kind of variable?
Sort each column of a bike-share dataset.
“trip_minutes: 12.5”
“member_type: casual / member”
“satisfaction: poor / ok / good / great”
“trip_id: 100482”
“bikes_available: 7”
“start_station_zip: 94107”
trip_minutes = [12, 18, 9, 21]
print("trips:", len(trip_minutes))
print("minutes recorded:", sum(trip_minutes))trips: 4 minutes recorded: 60
Key takeaways
Make the question specific: outcome, group and period.
Each row is one observation; each column a variable.
Numeric, categorical and ordinal variables need different summaries; IDs aren’t quantities.
Lesson quiz
6 questions · pass with 5 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: write Python
Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.
Count observations
Read one JSON array of numeric trip durations and print the number of observations.
- Four trips
- One trip
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Profile the columns
Read a CSV from standard input with csv.DictReader. For each column, print name: numeric (MIN-MAX) if every value parses as a number (format MIN and MAX with :g), otherwise name: categorical (N distinct). Then look at the output: which “numeric” column isn’t really a quantity?
- Trips
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…