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:20] Francesco Beretta [Histogram (p.5)] |
python:first_course_statistics [2016/10/17 07:41] Francesco Beretta [ScatterPlot (p. 7)] |
||
---|---|---|---|
Ligne 64: | Ligne 64: | ||
ax.set_title('Scatter Plot of INTERVAL vs DURATION') | ax.set_title('Scatter Plot of INTERVAL vs DURATION') | ||
plt.show() | plt.show() | ||
+ | </code> | ||
+ | |||
+ | ===== Boxplot (p.9) ===== | ||
+ | |||
+ | Selecting rows in a dataframe: [[http://pandas.pydata.org/pandas-docs/stable/indexing.html#the-where-method-and-masking|doc]] / [[http://stackoverflow.com/questions/17071871/select-rows-from-a-dataframe-based-on-values-in-a-column-in-pandas|example]] | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | gysr1 = pd.read_csv('../geyser1.tab', '\t') | ||
+ | gysr1_inf3 = gysr1.loc[gysr1['Duration'] <= 3] | ||
+ | gysr1_sup3 = gysr1.loc[gysr1['Duration'] > 3] | ||
+ | plt.boxplot([gysr1_inf3['Interval'],gysr1_sup3['Interval']], labels= ['inf3','sup3']) | ||
</code> | </code> | ||
====== International adoption rates (p.13) ====== | ====== International adoption rates (p.13) ====== | ||