<jupyter_start><jupyter_text>Let's find out what distribution our data isIn the data folder we have 4 datasets, load them and check what distributions they are<jupyter_code>data1 = pd.read_csv('data/StudentsPerformance.csv')
data2 = pd.read_csv('data/StudentsPerformance.csv')['writing score']
data3 = pd.read_csv('data/open-data-website-traffic.csv')['Socrata Sessions']
data4 = pd.read_csv('data/open-data-website-traffic.csv')['Socrata Bounce Rate']
data5 = pd.read_csv('data/HorseKicksDeath.csv')['C1']
# Tasks: 
what_is_this_distirution_1 = data1["math score"]
what_is_this_distirution_1.head(10)
fig = plt.figure(figsize=(15, 15)) 
plt.subplot(321)
plt.title("Histogram plot")
plt.hist(what_is_this_distirution_1, bins=BINS, alpha=0.5, label='poisson', color='b', edgecolor='k')
plt.subplot(322)
plt.title("Violineplot")
plt.violinplot(what_is_this_distirution_1, vert=False, widths=0.9, showmeans=True, showextrema=True, showmedians=True)
plt.show()
mu = np.mean(what_is_this_distirution_1)
sigma = np.std(what_is_this_distirution_1)
what_is_this_distirution_1_normalized = what_is_this_distirution_1.apply(lambda x: (x - mu)/sigma)
fig = plt.figure(figsize=(15, 15)) 
plt.subplot(321)
plt.title("Histogram plot")
plt.hist(what_is_this_distirution_1_normalized, bins=BINS, alpha=0.5, label='poisson', color='b', edgecolor='k')
plt.hist(gen_normal(0, 1, 1000)['observation'], bins=BINS, alpha=0.5, label='normal', color='g', edgecolor='k')
plt.gca().legend(('mistery','normal'))
plt.subplot(322)
plt.title("Violineplot")
plt.violinplot(what_is_this_distirution_1_normalized, vert=False, widths=0.9, showmeans=True, showextrema=True, showmedians=True)
plt.show()
qq = stats.probplot(what_is_this_distirution_1_normalized, plot=plt)
fig = plt.figure(figsize=(15, 15)) 
plt.subplot(321)
plt.title("Histogram plot")
plt.hist(data4, bins=BINS, alpha=0.5, label='poisson', color='b', edgecolor='k')
plt.subplot(322)
plt.title("Violineplot")
plt.violinplot(data4, vert=False, widths=0.9, showmeans=True, showextrema=True, showmedians=True)
plt.show()
#Looking at the second data set..
what_is_this_distirution_2 = data2
what_is_this_distirution_2.head(10)
mu = np.mean(what_is_this_distirution_2)
sigma = np.std(what_is_this_distirution_2)
what_is_this_distirution_2_normalized = what_is_this_distirution_2.apply(lambda x: (x - mu)/sigma)
fig = plt.figure(figsize=(15, 15)) 
plt.subplot(321)
plt.title("Histogram plot")
plt.hist(what_is_this_distirution_2_normalized, bins=BINS, alpha=0.5, label='poisson', color='b', edgecolor='k')
plt.hist(gen_weibull(1.5)['observation'], bins=BINS, alpha=0.5, label='normal', color='g', edgecolor='k')
plt.gca().legend(('mistery','weibull'))
plt.subplot(322)
plt.title("Violineplot")
plt.violinplot(what_is_this_distirution_2_normalized, vert=False, widths=0.9, showmeans=True, showextrema=True, showmedians=True)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15778546712802768, 'fraction_numerical': 0.03529411764705882, 'mean_word_length': 9.25177304964539, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '421241', 'license': 'MIT', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1140, 'n_words': 171, 'path': 'part_2/Distribution_exercises.ipynb', 'repo_name': 'terezaif/workshops_data_exploration', 'size': '2890'}