Using df, a cinema wants to see which genres occur most often.
The editable setup on the right creates df. Run executes the setup and your work from top to bottom.
Your requirements
- Choose "scatter", "histogram", "counts" or "line".
- Write the choice as a Python string.
Your inputs
| movie | genre | minutes | rating | screen |
|---|---|---|---|---|
| Moon | Drama | 90 | 3.7 | One |
| River | Comedy | 105 | 4.2 | One |
| Spark | Drama | 112 | 4.8 | Two |
| Stone | Action | 98 | 4 | Two |
| Map | Comedy | 85 | 3.9 | One |
| Cloud | Action | 120 | 4.5 | Two |
Remember 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.
| Code or choice | Meaning |
|---|---|
"scatter" | Relationship between two numeric measurements. |
"histogram" | Distribution of one numeric measurement. |
"counts" | Frequency of category labels. |
"line" | Change along an ordered sequence such as time. |
Hint
Genres are categories; the question asks about their frequencies.
Reveal solution
One way to do it. Keep any supplied setup in the editor and use this in the Your work section.
"counts"