The question
Explore the relationship between study hours and score without treating it as evidence of causation.
df Relationship viewYour inputs
df
One row is one learner’s study session and assessment. Hours and scores must stay paired; attendance is not an eligibility condition here.
Field meanings and units
submission_id- Attendance-submission identifier.
student- Learner label.
group- Comparison group.
hours- Study duration in hours.
score- Assessment score in points.
attended- Whether the learner attended.
date- Calendar date supplied as YYYY-MM-DD text unless the task states it is invalid.
submission_id | student | group | hours | score | attended | date |
|---|---|---|---|---|---|---|
| S001 | Learner 1 | A | 2 | 61 | false | 2026-04-01 |
| S002 | Learner 2 | B | 5 | 74 | true | 2026-04-01 |
| S003 | Learner 3 | A | 3 | 79 | true | 2026-04-02 |
| S004 | Learner 4 | B | 7 | None | true | 2026-04-02 |
| S005 | Learner 5 | A | 4 | 68 | false | 2026-04-03 |
View all 20 rows
submission_id | student | group | hours | score | attended | date |
|---|---|---|---|---|---|---|
| S001 | Learner 1 | A | 2 | 61 | false | 2026-04-01 |
| S002 | Learner 2 | B | 5 | 74 | true | 2026-04-01 |
| S003 | Learner 3 | A | 3 | 79 | true | 2026-04-02 |
| S004 | Learner 4 | B | 7 | None | true | 2026-04-02 |
| S005 | Learner 5 | A | 4 | 68 | false | 2026-04-03 |
| S006 | Learner 6 | B | 6 | 82 | true | 2026-04-03 |
| S007 | Learner 7 | A | None | 88 | true | 2026-04-04 |
| S008 | Learner 8 | B | 1 | 57 | true | 2026-04-04 |
| S009 | Learner 9 | A | 2 | 64 | false | 2026-04-05 |
| S010 | Learner 10 | B | 5 | 86 | true | 2026-04-05 |
| S011 | Learner 11 | A | 3 | 58 | true | 2026-04-06 |
| S012 | Learner 12 | B | 7 | 84 | true | 2026-04-06 |
| S013 | Learner 13 | A | 4 | 77 | false | 2026-04-07 |
| S014 | Learner 14 | B | 6 | 73 | true | 2026-04-07 |
| S015 | Learner 15 | A | 8 | 92 | true | 2026-04-08 |
| S016 | Learner 16 | B | 1 | 52 | true | 2026-04-08 |
| S017 | Learner 17 | A | 2 | 69 | false | 2026-04-09 |
| S018 | Learner 18 | B | 5 | 76 | true | 2026-04-09 |
| S019 | Learner 19 | A | 3 | 81 | true | 2026-04-10 |
| S020 | Learner 20 | B | 7 | 87 | true | 2026-04-10 |
The editable setup in Your Python creates these inputs when you run it.
Explore the relationship between study hours and score without treating it as evidence of causation.
pairsDataFramefigFigureDeliverables
Make the outputs listed below. Use each name exactly as shown. Then choose Check answer.
Python name key
Teal outlines name table columns. Violet left rules name Python objects. Dotted rules mark syntax, functions and parameters. Use each name exactly as shown.
- Complete pairsOutput
pairsDataFrame- Create
pairswithhoursand score only, keeping rows where both are known in their original row order.
- Create
- FigureOutput
figFigure- Create
figshowing one point for each completehours/score pair, withhourson the horizontal axis and score on the vertical axis. - Add a meaningful title and measure labels
- Display the figure.
Identify Hours and Score on the appropriate axes; extra wording is welcome.
- Create
Data policy Keep all supplied source tables unchanged. Work on separate outputs.
Help Hints & explained solution
Choose the amount of help you need. Opening one hint does not reveal the others.
Hint 1 — Think
Must both coordinates come from the same learner?
Hint 2 — Tools
dropna(), Axes.scatter() or sns.scatterplot()
Revisit: Drop missing rows · Scatter plot · Finish a chart properly
Hint 3 — Approach
Keep complete pairs and represent each learner’s two measurements together.
Explained solution
Add these lines below # Your work in the editor. The supplied input setup is already there.
pairs = df[['hours', 'score']].dropna()
fig, ax = plt.subplots()
ax.scatter(pairs.hours, pairs.score)
ax.set(title='Study hours and score', xlabel='Hours', ylabel='Score')
fig.tight_layout()
plt.show()View supplied setup
This code is already at the top of the editor.
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Supplied input: df (20 rows)
df = pd.DataFrame(
[
('S001', 'Learner 1', 'A', 2, 61, False, '2026-04-01'),
('S002', 'Learner 2', 'B', 5, 74, True, '2026-04-01'),
('S003', 'Learner 3', 'A', 3, 79, True, '2026-04-02'),
('S004', 'Learner 4', 'B', 7, None, True, '2026-04-02'),
('S005', 'Learner 5', 'A', 4, 68, False, '2026-04-03'),
('S006', 'Learner 6', 'B', 6, 82, True, '2026-04-03'),
('S007', 'Learner 7', 'A', None, 88, True, '2026-04-04'),
('S008', 'Learner 8', 'B', 1, 57, True, '2026-04-04'),
('S009', 'Learner 9', 'A', 2, 64, False, '2026-04-05'),
('S010', 'Learner 10', 'B', 5, 86, True, '2026-04-05'),
('S011', 'Learner 11', 'A', 3, 58, True, '2026-04-06'),
('S012', 'Learner 12', 'B', 7, 84, True, '2026-04-06'),
('S013', 'Learner 13', 'A', 4, 77, False, '2026-04-07'),
('S014', 'Learner 14', 'B', 6, 73, True, '2026-04-07'),
('S015', 'Learner 15', 'A', 8, 92, True, '2026-04-08'),
('S016', 'Learner 16', 'B', 1, 52, True, '2026-04-08'),
('S017', 'Learner 17', 'A', 2, 69, False, '2026-04-09'),
('S018', 'Learner 18', 'B', 5, 76, True, '2026-04-09'),
('S019', 'Learner 19', 'A', 3, 81, True, '2026-04-10'),
('S020', 'Learner 20', 'B', 7, 87, True, '2026-04-10'),
],
columns=['submission_id', 'student', 'group', 'hours', 'score', 'attended', 'date'],
)Why these steps exist
- Dropping incomplete pairs keeps each horizontal coordinate attached to its own vertical coordinate.
- The scatter shows association in these records. It does not establish that more study causes a particular score.
Another valid approach
Matplotlib and Seaborn point plots are accepted when each complete hours/score pair is represented once.