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/24 14:29] Beretta, Anna Letizia |
python:first_course_statistics [2016/10/26 19:34] Beretta, Anna Letizia |
||
---|---|---|---|
Ligne 137: | Ligne 137: | ||
\\ | \\ | ||
+ | |||
+ | =====Histogram with Log(p.18)===== | ||
+ | don't find the way to do it | ||
+ | <code Python> | ||
+ | import pandas as pd | ||
+ | import matplotlib.pyplot as plt | ||
+ | adopt = pd.DataFrame(pd.read_csv('D:\Python\Libri\A_Casebook_for_a_First_Course_in_Statistics_and_Data_Analysis_Datasets\Data\Tab\\adopt.TAB', '\t')) | ||
+ | adopt_loghist = adopt['Visa91'] | ||
+ | #adopt_loghist.semilogx() --> was one of the possibilities | ||
+ | ax = plt.gca() | ||
+ | ax.hist(adopt_loghist, bins=10, plt.loglog(0.5,3.5), color='r') #put log=True instead, but you will get the log for the frequencies | ||
+ | plt.gca().set_xscale("log") | ||
+ | ax.set_xlabel('Log (Number of 1991 visas') | ||
+ | ax.set_ylabel('Frequency') | ||
+ | ax.set_title('Histogram') | ||
+ | plt.show() | ||
+ | </code> | ||
Ligne 161: | Ligne 178: | ||
=====Scatterplot (p.18)===== | =====Scatterplot (p.18)===== | ||
+ | <code python> | ||
import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
import pandas as pd | import pandas as pd |