Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | Prochaine révision Les deux révisions suivantes | ||
python:first_course_statistics [2016/10/17 07:58] Francesco Beretta [Descriptive statistics] |
python:first_course_statistics [2016/10/19 14:57] Beretta, Anna Letizia |
||
---|---|---|---|
Ligne 65: | Ligne 65: | ||
plt.show() | plt.show() | ||
</code> | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
===== Descriptive statistics (p.9) ===== | ===== Descriptive statistics (p.9) ===== | ||
Ligne 77: | Ligne 81: | ||
gysr1['Duration'][gysr1['Duration'] <= 3].describe() | gysr1['Duration'][gysr1['Duration'] <= 3].describe() | ||
</code> | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
Ligne 91: | Ligne 98: | ||
plt.boxplot([gysr1_inf3['Interval'],gysr1_sup3['Interval']], labels= ['inf3','sup3']) | plt.boxplot([gysr1_inf3['Interval'],gysr1_sup3['Interval']], labels= ['inf3','sup3']) | ||
</code> | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
====== International adoption rates (p.13) ====== | ====== International adoption rates (p.13) ====== | ||
+ | ===== Boxplot (p.14) ===== | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | adopt_data = pd.read_csv('D:\Python\Libri\A_Casebook_for_a_First_Course_in_Statistics_and_Data_Analysis_Datasets\Data\Tab\\adopt.TAB', '\t') | ||
+ | adopt1 = adopt_data['Visa91'] | ||
+ | plt.boxplot(adopt1) | ||
+ | ax = plt.gca() | ||
+ | ax.set_title('Box and Whisker Plot') | ||
+ | ax.set_xlabel('39 cases') | ||
+ | ax.set_ylabel('Number of visas in 1991') | ||
+ | plt.show() | ||
+ | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | ===== Histogram (p.14) ===== | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | adopt_data = pd.read_csv('D:\Python\Libri\A_Casebook_for_a_First_Course_in_Statistics_and_Data_Analysis_Datasets\Data\Tab\\adopt.TAB', '\t') | ||
+ | adopt1 = adopt_data['Visa91'] | ||
+ | plt.hist(adopt1) | ||
+ | plt.show() | ||
+ | </code> |