Exercise

Question 1: Create a dataframe olympicsMedalTally of top 10 countries of 2016 Olympics medal table as below

Create Two Lists of Student Ids & Student Heights

In [5]:
Country = ['United States(USA)', 'Great Britain(GBR)', 'China(CHN)', 'Russia(RUS)', 'Germany(GER)', 
           'Japan(JPN)', 'France(FRA)', 'South Korea(KOR)', 'Italy(ITA)', 'Australia(AUS)']

Gold = [46, 27, 26, 19, 17, 12, 10, 9, 8, 8]

Create a dataframe of these two lists using DataFrame() method

In [11]:
import pandas as pd
olympicsMedalTally = pd.DataFrame({'Country': Country, 'Gold': Gold})

Question 2: Calculate all Measures of Central Tendency

Mean

In [14]:
olympicsMedalTally['Gold'].mean()
Out[14]:
18.2

Median

In [15]:
olympicsMedalTally['Gold'].median()
Out[15]:
14.5

Mode

In [16]:
olympicsMedalTally['Gold'].mode()
Out[16]:
0    8
dtype: int64

Question 3: Calculate all Measures of Dispersion

Range

In [17]:
olympicsMedalTally['Gold'].max() - studentHeightDf['Gold'].min()
Out[17]:
38

Standard Deviation

In [18]:
olympicsMedalTally['Gold'].std()
Out[18]:
12.072006185109968

Quartile

In [19]:
olympicsMedalTally['Gold'].quantile([.25, .50, .75])
Out[19]:
0.25     9.25
0.50    14.50
0.75    24.25
Name: Gold, dtype: float64

Skewness

In [20]:
olympicsMedalTally['Gold'].skew()
Out[20]:
1.495941239339713

Kurtosis

In [21]:
olympicsMedalTally['Gold'].kurtosis()
Out[21]:
2.256097367750457