| number | film | release_date | run_time | film_rating | rotten_tomatoes | metacritic | cinema_score | critics_choice |
|---|---|---|---|---|---|---|---|---|
| 1 | Toy Story | 1995-11-22 | 81.000000 | G | 100.000000 | 95.000000 | A | nan |
| 2 | A Bug's Life | 1998-11-25 | 95.000000 | G | 92.000000 | 77.000000 | A | nan |
| 3 | Toy Story 2 | 1999-11-24 | 92.000000 | G | 100.000000 | 88.000000 | A+ | 100.000000 |
| 4 | Monsters, Inc. | 2001-11-02 | 92.000000 | G | 96.000000 | 79.000000 | A+ | 92.000000 |
| 5 | Finding Nemo | 2003-05-30 | 100.000000 | G | 99.000000 | 90.000000 | A+ | 97.000000 |
| 6 | The Incredibles | 2004-11-05 | 115.000000 | PG | 97.000000 | 90.000000 | A+ | 88.000000 |
| 7 | Cars | 2006-06-09 | 117.000000 | G | 74.000000 | 73.000000 | A | 89.000000 |
| 8 | Ratatouille | 2007-06-29 | 111.000000 | G | 96.000000 | 96.000000 | A | 91.000000 |
| 9 | WALL-E | 2008-06-27 | 98.000000 | G | 95.000000 | 95.000000 | A | 90.000000 |
| 10 | Up | 2009-05-29 | 96.000000 | PG | 98.000000 | 88.000000 | A+ | 95.000000 |
| 11 | Toy Story 3 | 2010-06-18 | 103.000000 | G | 98.000000 | 92.000000 | A | 97.000000 |
| 12 | Cars 2 | 2011-06-24 | 106.000000 | G | 40.000000 | 57.000000 | A- | 67.000000 |
| 13 | Brave | 2012-06-22 | 93.000000 | PG | 78.000000 | 69.000000 | A | 81.000000 |
| 14 | Monsters University | 2013-06-21 | 104.000000 | G | 80.000000 | 65.000000 | A | 79.000000 |
| 15 | Inside Out | 2015-06-19 | 95.000000 | PG | 98.000000 | 94.000000 | A | 93.000000 |
| 16 | The Good Dinosaur | 2015-11-25 | 93.000000 | PG | 76.000000 | 66.000000 | A | 75.000000 |
| 17 | Finding Dory | 2016-06-17 | 97.000000 | PG | 94.000000 | 77.000000 | A | 89.000000 |
| 18 | Cars 3 | 2017-06-16 | 102.000000 | G | 69.000000 | 59.000000 | A | 66.000000 |
| 19 | Coco | 2017-11-22 | 105.000000 | PG | 97.000000 | 81.000000 | A+ | 89.000000 |
| 20 | Incredibles 2 | 2018-06-15 | 118.000000 | PG | 93.000000 | 80.000000 | A+ | 86.000000 |
| 21 | Toy Story 4 | 2019-06-21 | 100.000000 | G | 97.000000 | 84.000000 | A | 94.000000 |
| 22 | Onward | 2020-03-06 | 102.000000 | PG | 88.000000 | 61.000000 | A- | 79.000000 |
| 23 | Soul | 2020-12-25 | 100.000000 | PG | 96.000000 | 83.000000 | nan | 93.000000 |
| 24 | Luca | 2021-06-18 | 151.000000 | nan | nan | nan | nan | nan |
| 25 | Turning Red | 2022-03-11 | nan | nan | nan | nan | nan | nan |
| 26 | Lightyear | 2022-06-17 | nan | nan | nan | nan | nan | nan |
| 27 | Elemental | 2023-06-16 | 155.000000 | Not Rated | nan | nan | nan | nan |
3 Summarising and displaying categorical data
Two common statistics are the number of categories and the mode, which is the most common value.
Example: Pixar films
Release, runtime, and critical reception data for Pixar’s feature films (see here for a brief description of the dataset).
Two of the categorical variables in the Pixar dataset are film_rating and cinema_score. For each, we can report the number of categories and the mode:
| variable | number of categories | mode |
|---|---|---|
| film_rating | 3 | G |
| cinema_score | 3 | A |
film_rating has 3 categories, and the most common one is G. cinema_score also has 3 categories, and the most common one is A.
A more complete picture is provided by the frequency table, which lists the categories of a categorical variable and the count of observations for each category.
For example, the frequency table for cinema_score:
| cinema_score | count |
|---|---|
| A | 13 |
| A+ | 7 |
| A- | 2 |
A relative frequency table displays percentages (or proportions) rather than the counts in each category. Both types of tables show the distribution of a categorical variable because they list the possible categories and indicate how often each occurs.
For example, the relative frequency table for cinema_score:
| cinema_score | percentage |
|---|---|
| A | 59.100000 |
| A+ | 31.800000 |
| A- | 9.100000 |
A visual representation of the frequency table: bar charts.
For example, here are the counts and the percentages for cinema_score displayed as bar charts:
Bar charts are easier than tables to compare frequencies: easy to see the mode and the 2nd most common category, and that there are twice as many observations in the most common category as in the second most common.
There are a few other representations of the distribution, but none are as easy to understand as bar charts.
Pie charts. The same cinema_score distribution, as a pie chart:
Pie charts are harder to read than bar charts.
- Don’t try to interpret the shape of a bar chart. Category order is arbitrary in a bar chart.
- A plot should always have labels of the x-axis and y-axis (with units).