Using grouped boxplots to uncover unexpected values in a particular group
We saw in the previous recipe that boxplots are a great tool for examining the distribution of continuous variables. They can also be useful when we want to see if those variables are distributed differently for parts of our dataset, such as salaries for different age groups, number of children by marital status, or litter sizes of different mammal species. Grouped boxplots are a handy and intuitive way to view differences in variable distribution by categories in our data.
Getting ready
We will work with the NLS and the COVID-19 case data. You will need Matplotlib and Seaborn installed on your computer to run the code in this recipe.
How to do it...
We generate descriptive statistics of weeks worked by highest degree earned. We then use grouped boxplots to visualize the spread of the weeks worked distribution by degree, and of COVID-19 cases by region:
- Import the
pandas
,matplotlib...