Understand the idea
Choose a chart from the question and the types of data. Decide what each mark should represent before writing plotting code.
A small example
“Do longer study times go with higher scores?” compares two measurements per person, so one point per person is useful.
Follow the code
Apply the idea to the supplied table. Read from top to bottom; the final line displays the result.
"scatter"What each part does
"scatter"- relationship between two numeric variables
"histogram"- distribution of one numeric variable
"counts"- frequency of category labels
"line"- change along an ordered time sequence
Your inputs
The editable setup on the right creates df. Run executes the setup and your work from top to bottom.
| student | club | hours | score | group |
|---|---|---|---|---|
| Ari | Art | 1 | 52 | A |
| Bo | Code | 3 | 71 | A |
| Cy | Art | 2 | 65 | B |
| Dee | Code | 4 | 82 | B |
| Eli | Art | 5 | 89 | A |
| Flo | Code | 3 | 76 | A |
| Gus | Art | 6 | 93 | B |
| Han | Code | 2 | 61 | B |
Your task · Follow
- Using df, which chart would help ask whether students who study longer tend to score higher?
- Write "scatter", "histogram", "counts" or "line" as your final Python string.
Hint
Identify the two numeric variables.
Reveal solution
One way to do it. Keep any supplied setup in the editor and use this in the Your work section.
"scatter"