Performing Experiments in Python
Luke Hayden
Instructor
Mean
Median
Mode
Standard deviation
print(p9.ggplot(countrydata)+ p9.aes(x= 'Life_exp')+ p9.geom_density(alpha=0.5))
Mean
print(countrydata.Life_exp.mean())
73.68201058201058
Median
print(countrydata.Life_exp.median())
76.0
Mode
print(countrydata.Life_exp.mode())
78.4
Normal probability plot
Use
Basis
from scipy import stats
import plotnine as p9
tq = stats.probplot(countrydata.Life_exp, dist="norm")
df = pd.DataFrame(data = {'Theoretical Quantiles': tq[0][0],
"Ordered Values": countrydata.Life_exp.sort_values() })
print(p9.ggplot(df)+ p9.aes('Theoretical Quantiles', "Ordered Values") +p9.geom_point())
Distribution
Q-Q plot
Performing Experiments in Python