Outils pour utilisateurs

Outils du site


python:first_course_statistics

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

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/17 07:52]
Francesco Beretta [Boxplot (p.9)]
python:first_course_statistics [2016/10/24 14:30]
Beretta, Anna Letizia [Scatterplot (p.18)]
Ligne 66: Ligne 66:
 </​code>​ </​code>​
  
-===== Descriptive statistics ===== 
  
-Note: try different examples, ​ie. the whole population or only those where '​Duration'​ <= 3+\\ 
 + 
 + 
 +===== Descriptive statistics (p.9) ===== 
 + 
 +Note: try different examples, ​e.g. the whole population or only those where '​Duration'​ <= 3, the whole dataframe
  
 [[http://​pandas.pydata.org/​pandas-docs/​stable/​basics.html#​descriptive-statistics|doc]] – [[http://​www.marsja.se/​pandas-python-descriptive-statistics/​|example]] [[http://​pandas.pydata.org/​pandas-docs/​stable/​basics.html#​descriptive-statistics|doc]] – [[http://​www.marsja.se/​pandas-python-descriptive-statistics/​|example]]
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>​
 +
 +
 +\\
 +
 +
 +=====Scatterplot (p. 17)=====
 +<code python>
 +import matplotlib.pyplot as plt
 +import pandas as pd
 +adoption_scatterplot = pd.read_csv('​...\adopt.TAB',​ '​\t'​)
 +adopt_data_Xax = adoption_scatterplot['​Visa88'​]
 +adopt_data_Yax = adoption_scatterplot['​Visa91'​]
 +plt.scatter(adopt_data_Xax,​ adopt_data_Yax,​ facecolor='​y',​ edgecolor='​y'​)
 +ax = plt.gca()
 +ax.set_xlabel('​Number of Visas in 1988')
 +ax.set_ylim([0,​2700])
 +ax.set_xlim([0,​5000])
 +ax.set_ylabel('​Number of Visas in 1991')
 +ax.set_title('​ScatterPlot of Visa91 vs Visa88'​)
 +plt.show()
 +</​code>​
 +
 +
 +\\
 +
 +
 +=====Scatterplot (p.18)=====
 +<code python>
 +import matplotlib.pyplot as plt
 +import pandas as pd
 +adoption_scatterplot = pd.read_csv('​D:​\Python\Libri\A_Casebook_for_a_First_Course_in_Statistics_and_Data_Analysis_Datasets\Data\Tab\\adopt.TAB',​ '​\t'​)
 +adopt_data_Xax = adoption_scatterplot['​Visa91'​]
 +adopt_data_Yax = adoption_scatterplot['​Visa92'​]
 +plt.scatter(adopt_data_Xax,​ adopt_data_Yax,​ facecolor='​y',​ edgecolor='​y'​)
 +ax = plt.gca()
 +ax.set_xlabel('​Number of Visas in 1991')
 +ax.set_ylim([0,​1800])
 +ax.set_xlim([0,​2700])
 +ax.set_ylabel('​Number of Visas in 1992')
 +ax.set_title('​ScatterPlot of Visa92 vs Visa91'​)
 +plt.show()
 +</​code>​
 +
  
python/first_course_statistics.txt · Dernière modification: 2017/09/26 08:54 par Francesco Beretta