Page 3 of 8~104 min topic

Data: tables and simple plots

Build the first working study table and plot

Page 3 implements the shortest complete path for the study-hours table plus hours-vs-pass plot with inspectable intermediate values.

~13 min this pageImplementation

1Learn the idea

Read

Implement the minimal working path

Build only what the claim requires: CSV summaries and a saved plot file have explicit axes and a reproducible path. Prefer boring, deterministic code over frameworks you cannot yet explain. Run the path twice; identical output on this fixture is a feature, not a lack of creativity.

Read

Run the working path

import io,pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
df=pd.read_csv(io.StringIO('hours,passed\n1,0\n3,0\n5,1\n12,1\n'))
print('mean_hours', float(df.hours.mean()), 'max_hours', int(df.hours.max()))
plt.scatter(df.hours, df.passed); plt.xlabel('hours'); plt.ylabel('passed')
plt.savefig('hours_vs_pass.png'); print('wrote hours_vs_pass.png')

Expected evidence: mean/max hours and plot path. Read each printed intermediate as part of the argument that the path works—not as decoration.

Read

Trace one input end to end

Narrate the journey from raw input to result for a single example from four-row study.csv with hours and passed columns. If you cannot name an intermediate, the implementation is still too opaque for this lab. Only after this path is solid should you generalize data sources or UI.

Read

Lab notebook: intermediates worth printing

While implementing the study table and plot, print or log at least three intermediates that map to the claim (CSV summaries and a saved plot file have explicit axes and a reproducible path). Good intermediates are values a teammate could recompute with a calculator or diff. Bad intermediates are framework traces you cannot explain.

Re-run with four-row study.csv with hours and passed columns twice. If the second run differs, either the path is nondeterministic (document the seed) or you have hidden global state—both are lab bugs until named.

Read

Worked judgment

Stop adding features once the path supports inspect typical hours, an extreme value, and the hours/pass relationship. Extra UI, extra tools, or extra models belong in later chapters. The mastery bar for this page is simply: a deterministic end-to-end path with intermediates.

Read

Why this stage matters for the study table and plot

At the implementation stage for data-tables-and-plots, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about four-row study.csv with hours and passed columns that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: hand-computed mean of the four-row fixture.

For this page specifically, success looks like a deterministic path with printed intermediates while still centering the user decision to inspect typical hours, an extreme value, and the hours/pass relationship. If you cannot point to a file, command, or assertion that proves that for the study table and plot, stay on this page instead of advancing.

Pandas glossary

Previous · Next

Go deeper

Before you start

Why this matters

Without running code, predict the final output for fixture four-row study.csv with hours and passed columns. Name one intermediate value that would prove the prediction. Then answer: what could look successful while actually being wrong at this stage for the study table and plot?

In the wild

See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Can you narrate every intermediate value?
2. Is the fixture deterministic and independently inspectable?
3. Did you avoid framework behavior you cannot explain yet?
4. Does the output still support the decision: inspect typical hours, an extreme value, and the hours/pass relationship?

All responses are required.