Sub topic 11
Writing down findings next to the evidence
This chapter assumes you have a cleaned DataFrame named df from the earlier cleaning chapter. It also assumes you can write basic Markdown in a notebook cell. A notebook full of good plots still fails if the reader has to guess what each plot means. A finding is a written statement placed right beside the output that supports it.
Why write findings as you go
If you save conclusions for the end, you forget why you reached them. You also lose the dead ends, which are worth recording. A finding written next to its plot or table can be checked by anyone who reads the notebook, including you in a month.
The four parts of a finding
Each finding in the notebook has four parts:
- Observation: what you see, stated plainly in the heading.
- Evidence: the cell, plot, or number that shows it.
- Hypothesis: a possible explanation, worded as a guess.
- Next step: the check that would confirm or reject the guess.
Keeping the hypothesis separate from the observation matters. "Amounts are right-skewed" is something you can see. "A few large orders drive the mean" is an idea you still have to test.
Worked example
Suppose the histogram of amount shows a long right tail. First, put numbers in a code cell so the claim does not rest on a picture alone:
print(df["amount"].agg(["mean", "median"]).round(2))
print("skew:", round(df["amount"].skew(), 2))
threshold = df["amount"].quantile(0.95)
large = df[df["amount"] > threshold]
print("share of large orders by region:")
print(large["region"].value_counts(normalize=True).round(2))
print("share of all orders by region:")
print(df["region"].value_counts(normalize=True).round(2))A mean well above the median and a positive skew support the first claim. Comparing the two region tables carries out the next step. If one region has a much larger share of large orders than of all orders, that region is worth a closer look.
Then add a Markdown cell directly below the output:
### Finding: order amounts are right-skewed
- **Evidence:** the histogram above and the median-versus-mean gap in `describe()`.
- **Hypothesis:** a few large orders drive the mean; the median is a better summary.
- **Next step:** check whether the large orders cluster in one region.After you run the check, update the cell. Add a line such as "Result: the large orders are spread evenly across regions, so the hypothesis about one region is rejected." Keep rejected hypotheses. They stop the next reader from repeating your work.
Habits that keep the log useful
- Put the finding directly below its evidence, not in a separate section at the end.
- Use the same heading prefix, such as
### Finding:, so you can find every finding by scanning the outline. - Write numbers in the text only if the cell above prints them. Otherwise they go stale when the data changes.
- Keep a short
### Open questionscell for things you noticed but have not checked.
Exercise
A histogram of delivery_days shows a second small peak near 14 days. Write the four parts of a finding for it, and say which part must be a runnable check.
Show answer
Observation: delivery times have a second small peak near 14 days. Evidence: the histogram plus a count such as (df["delivery_days"].between(13, 15)).sum(). Hypothesis: a subset of orders, perhaps one shipping method or region, is slower. Next step: group delivery_days by shipping_method and region and compare medians. The next step must be the runnable check, because it is the part that can confirm or reject the hypothesis.