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 | Révision précédente Prochaine révision Les deux révisions suivantes | ||
python:first_course_statistics [2016/10/09 23:21] Francesco Beretta [General instructions] |
python:first_course_statistics [2016/10/17 07:20] Francesco Beretta [Histogram (p.5)] |
||
---|---|---|---|
Ligne 13: | Ligne 13: | ||
===== Histogram (p.5) ===== | ===== Histogram (p.5) ===== | ||
- | |||
- | FB: this script works fine ! | ||
<code python> | <code python> | ||
Ligne 31: | Ligne 29: | ||
\\ | \\ | ||
+ | |||
+ | ===== Boxplot (p. 6) ===== | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | gysr1_boxplot = pd.read_csv('...\geyser1.TAB', '\t') | ||
+ | data_gysr1 = gysr1_boxplot['Interval'] | ||
+ | plt.boxplot(data_gysr1) | ||
+ | ax = plt.gca() | ||
+ | ax.set_xlabel('222 cases') | ||
+ | ax.set_ylabel('Interruption time ( minutes') | ||
+ | ax.set_title('Box and Whisker Plot') | ||
+ | plt.show() | ||
+ | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | ===== ScatterPlot (p. 7) ===== | ||
+ | |||
+ | AB: Put face- and edgecolor to change both of them. You can also have two different colors for the in- and outside of each dot. | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | geysr1_scatterplot = pd.read_csv('...\geyser1.TAB', '\t') | ||
+ | geysr1_data_Xax = geysr1_scatterplot['Duration'] | ||
+ | geysr1_data_Yax = geysr1_scatterplot['Interval'] | ||
+ | plt.scatter(geysr1_data_Xax, geysr1_data_Yax, facecolor='y', edgecolor='y') | ||
+ | ax = plt.gca() | ||
+ | ax.set_xlabel('Eruption duration time (minutes)') | ||
+ | ax.set_ylabel('Interuption time (minutes)') | ||
+ | ax.set_title('Scatter Plot of INTERVAL vs DURATION') | ||
+ | plt.show() | ||
+ | </code> | ||
====== International adoption rates (p.13) ====== | ====== International adoption rates (p.13) ====== | ||