python:first_course_statistics
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| python:first_course_statistics [2016/10/19 14:57] – alberetta | python:first_course_statistics [2017/09/26 08:54] (Version actuelle) – [General instructions] fberetta | ||
|---|---|---|---|
| Ligne 5: | Ligne 5: | ||
| * pandas [[http:// | * pandas [[http:// | ||
| * [[http:// | * [[http:// | ||
| + | |||
| + | |||
| + | Get the data from [[http:// | ||
| + | |||
| Save your scripts in a folder inside the data folder, calling the script folder ' | Save your scripts in a folder inside the data folder, calling the script folder ' | ||
| Ligne 35: | Ligne 39: | ||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
| import pandas as pd | import pandas as pd | ||
| - | gysr1_boxplot = pd.read_csv(' | + | gysr1_boxplot = pd.read_csv(' |
| data_gysr1 = gysr1_boxplot[' | data_gysr1 = gysr1_boxplot[' | ||
| plt.boxplot(data_gysr1) | plt.boxplot(data_gysr1) | ||
| Ligne 55: | Ligne 59: | ||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
| import pandas as pd | import pandas as pd | ||
| - | geysr1_scatterplot = pd.read_csv(' | + | geysr1_scatterplot = pd.read_csv(' |
| geysr1_data_Xax = geysr1_scatterplot[' | geysr1_data_Xax = geysr1_scatterplot[' | ||
| geysr1_data_Yax = geysr1_scatterplot[' | geysr1_data_Yax = geysr1_scatterplot[' | ||
| Ligne 132: | Ligne 136: | ||
| adopt1 = adopt_data[' | adopt1 = adopt_data[' | ||
| plt.hist(adopt1) | plt.hist(adopt1) | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | =====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(' | ||
| + | adopt_loghist = adopt[' | ||
| + | # | ||
| + | ax = plt.gca() | ||
| + | ax.hist(adopt_loghist, | ||
| + | plt.gca().set_xscale(" | ||
| + | ax.set_xlabel(' | ||
| + | ax.set_ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | =====Scatterplot (p. 17)===== | ||
| + | <code python> | ||
| + | import matplotlib.pyplot as plt | ||
| + | import pandas as pd | ||
| + | adoption_scatterplot = pd.read_csv(' | ||
| + | adopt_data_Xax = adoption_scatterplot[' | ||
| + | adopt_data_Yax = adoption_scatterplot[' | ||
| + | plt.scatter(adopt_data_Xax, | ||
| + | ax = plt.gca() | ||
| + | ax.set_xlabel(' | ||
| + | ax.set_ylim([0, | ||
| + | ax.set_xlim([0, | ||
| + | ax.set_ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | |||
| + | =====Scatterplot (p.18)===== | ||
| + | <code python> | ||
| + | import matplotlib.pyplot as plt | ||
| + | import pandas as pd | ||
| + | adoption_scatterplot = pd.read_csv(' | ||
| + | adopt_data_Xax = adoption_scatterplot[' | ||
| + | adopt_data_Yax = adoption_scatterplot[' | ||
| + | plt.scatter(adopt_data_Xax, | ||
| + | ax = plt.gca() | ||
| + | ax.set_xlabel(' | ||
| + | ax.set_ylim([0, | ||
| + | ax.set_xlim([0, | ||
| + | ax.set_ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | |||
| + | ====== The Performance of stock mutual funds (p. 21) ====== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | ====== Predicting the sales and airplay of popular music (p. 23)====== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | ====== Another look at the "Old faithful" | ||
| + | |||
| + | Modified the bins of the both histograms: | ||
| + | The Histogram is reliable for the "Old faithful" | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ====== Productivity versus quality in the assembly plant (p. 25)====== | ||
| + | |||
| + | |||
| + | ===== Scatterplot of Productivity vs Quality (p. 26) ===== | ||
| + | <code Python> | ||
| + | import pandas as pd | ||
| + | import matplotlib.pyplot as plt | ||
| + | scatter_plot = pd.read_csv(' | ||
| + | productivity_Y = scatter_plot[' | ||
| + | quality_X = scatter_plot[' | ||
| + | plt.scatter(productivity_Y, | ||
| + | ax = plt.gca() | ||
| + | ax.set_Xlabel(' | ||
| + | ax.set_Ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | =====Scatter Plot of PRODJAPN vs QUALJAPN (p. 27) ===== | ||
| + | |||
| + | <code Python> | ||
| + | import pandas as pd | ||
| + | import matplotlib.pyplot as plt | ||
| + | scatter_plot = pd.read_csv(' | ||
| + | productivity_Y = scatter_plot[' | ||
| + | quality_X = scatter_plot[' | ||
| + | plt.scatter(productivity_Y, | ||
| + | ax = plt.gca() | ||
| + | ax.set_Xlabel(' | ||
| + | ax.set_Ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | =====Scatter Plot of PRODNONJ cs QUALNONJ (p. 27)===== | ||
| + | <code Python> | ||
| + | import pandas as pd | ||
| + | import matplotlib.pyplot as plt | ||
| + | scatter_plot = pd.read_csv(' | ||
| + | productivity_Y = scatter_plot[' | ||
| + | quality_X = scatter_plot[' | ||
| + | plt.scatter(productivity_Y, | ||
| + | ax = plt.gca() | ||
| + | ax.set_Xlabel(' | ||
| + | ax.set_Ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Scatterplot of productivity VS quality (p. 28) ===== | ||
| + | <code python> | ||
| + | import pandas as pd | ||
| + | import matplotlib.pyplot as plt | ||
| + | scatter_plot = pd.read_csv(' | ||
| + | productivity_Y = scatter_plot[' | ||
| + | quality_X = scatter_plot[' | ||
| + | plt.scatter(productivity_Y, | ||
| + | ax = plt.gca() | ||
| + | ax.set_Xlabel(' | ||
| + | ax.set_Ylabel(' | ||
| + | ax.set_title(' | ||
| + | plt.show() | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Productivity versus quality in the assembly plant (p.29) ===== | ||
| + | |||
| + | It worked the first time but now it doesn' | ||
| + | |||
| + | <code python> | ||
| + | #1 | ||
| + | import matplotlib.pyplot as plt | ||
| + | import pandas as pd | ||
| + | data_comparison = pd.read_csv(' | ||
| + | non_japanese = data_comparison.loc[data_comparison[' | ||
| + | japanese = data_comparison.loc[data_comparison[' | ||
| + | plt.boxplot([non_japanese[' | ||
| + | plt.show() | ||
| + | |||
| + | #2 | ||
| + | import matplotlib.pyplot as plt | ||
| + | import pandas as pd | ||
| + | data_comparison = pd.read_csv(' | ||
| + | non_japanese = data_comparison.loc[data_comparison[' | ||
| + | japanese = data_comparison.loc[data_comparison[' | ||
| + | plt.boxplot([non_japanese[' | ||
| plt.show() | plt.show() | ||
| </ | </ | ||
python/first_course_statistics.1476881851.txt.gz · Dernière modification : de alberetta
