Lesson 12
First Python data example
Big question
How do we take the first small step from data to interpretation?
Lesson progress
Complete checkpoints as you learn
Learning objectives
- Explain first python data example in plain language.
- Use descriptive relationship correctly in an interpretation.
- Connect the lesson idea to a formula, graph, Python result, or real example.
Simple explanation
The first Python example loads the wage dataset, summarizes it, and checks the relationship between wage and education. The interpretation is descriptive, not yet causal.
Key terms
- Descriptive relationship
- An observed pattern in the sample.
- Regression preview
- An early look at how one variable changes with another before deeper modeling.
- Interpretation
- A plain-language explanation of what the output suggests.
- Caution
- A reminder not to overclaim cause and effect.
Simple regression preview
Example
If average wages are higher among more educated workers in the sample, we can describe that pattern and then ask what else must be considered before making a causal claim.
First data example
1import pandas as pd2 3df = pd.read_csv("wage_sample.csv")4print(df[["wage", "education", "experience"]].describe())5print(df["wage"].corr(df["education"]))6 7grouped = df.groupby("education")["wage"].mean()8print(grouped)Live notebook
Run this lesson as a notebook
Open an editable notebook cell-by-cell, run Python in the browser, and download the `.ipynb` file for later.
Checkpoint activity
Pause and explain this lesson's main idea in your own words before moving forward.
Try it yourself
Write one plain-English sentence explaining the main idea from this lesson.
Common mistakes
Check these before you move on.
A regression coefficient describes a pattern unless the assumptions or research design support a causal interpretation.
Quick quiz
What should we avoid after a first descriptive Python result?
Key takeaway
The first analysis should describe clearly and interpret cautiously.