Loading
0x00Lesson 1 of 10

Start with a data question

Turn a broad curiosity into a question data can answer, and learn the workflow and vocabulary of data science.

18 min 6-question quiz 2 code exercises
By the end of this lesson you can
  • 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:

  1. Ask a specific question.
  2. Get the data - and learn how it was collected.
  3. Clean it: fix types, missing values, duplicates.
  4. Explore: summarize and visualize.
  5. Model or test: estimate relationships and uncertainty.
  6. 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:

KindExampleSensible summaries
Numeric, continuoustrip minutes, temperaturemean, median, spread
Numeric, discrete (counts)bikes at a stationmean, median, totals
Categorical, nominalmode: bus / bike / walkcounts, shares
Categorical, ordinalrating: poor < ok < greatcounts, 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 XP

What kind of variable?

Sort each column of a bike-share dataset.

0 of 6 sortedScore 0/0
  • “trip_minutes: 12.5”

  • “member_type: casual / member”

  • “satisfaction: poor / ok / good / great”

  • “trip_id: 100482”

  • “bikes_available: 7”

  • “start_station_zip: 94107”

first_look.py
trip_minutes = [12, 18, 9, 21]
print("trips:", len(trip_minutes))
print("minutes recorded:", sum(trip_minutes))
Output
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.

Exercise 1

Count observations

+25 XP

Read one JSON array of numeric trip durations and print the number of observations.

  • Four trips
  • One trip
main.py
Loading editor…

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.

Exercise 2

Profile the columns

+25 XP

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
main.py
Loading editor…

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…