2. Static Visualization – Global Patterns and Summary Statistics
Activity 2: Design Static Visualization to Present Global Patterns and Summary Statistics
Solution
- Load the necessary python modules and download the
Olympic History
dataset hosted in the book's GitHub repository, and format it as apandas
DataFrame:# load necessary modules import pandas as pd import seaborn as sns from numpy import median, mean # download file 'athlete_events.csv' from course GitHub repository: https://github.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/datasets # read the dataset as a pandas DataFrame olympics_df = pd.read_csv('../Interactive-Data-Visualization-with-Python-master/datasets/athlete_events.csv') # preview DataFrame olympics_df.head()
The output is as follows:
Figure 2.22: Olympic History dataset
- Filter the DataFrame to contain only the medal winners of the year 2016 for the sports mentioned in the activity description:
# filter...