<jupyter_start><jupyter_text>1. Mew = student_growth 2. Sample = student_growth of top 50 neighborhood according to hardship index 3. sigma = std(sample) 4. df = len(sample) -1<jupyter_code>df_1 = final_df.copy()
df_1.hardship_index = df_1.hardship_index.astype(int)
df_1
subset_df = df_1[df_1.hardship_index < 10]
subset_df
df_1.student_growth.value_counts()
print(f'subset mean: {subset_df.student_growth.mean()} and population mean: {df_1.student_growth.mean()}')
plt.rcParams["font.weight"] = "bold"
plt.rcParams["axes.labelweight"] = "bold"

one_sample_ttest(subset_df.student_growth,df_1.student_growth.mean(),.05)
plt.xlabel('Student Growth Rate')
plt.title('Student Growth Rate Distribution\n Distribution')
plt.axvline(x=subset_df.student_growth.mean(), color='red', label='Top 10\nmean\n2.333')
plt.axvline(x=df_1.student_growth.mean(), color='blue', label= 'Popluation\nmean\n1.932')
# plt.text(2.55,.2,'Top 10\nmean\n2.333', color='red',horizontalalignment='center')
# plt.text(1.6,.18,'Popluation\nmean\n1.932', color='blue',horizontalalignment='center')
plt.legend()
not_subset_df = df_1[df_1['hardship_index'] >= 30]
sns.distplot(subset_df.student_growth, hist=False, rug=True, color='red', label='Top 10', bins=4, hist_kws={"range": [.5,4.5]})
sns.distplot(not_subset_df.student_growth, hist=True, rug=True, color='blue', label='All', bins=4, hist_kws={"range": [.5,4.5]})
plt.title('Top 10 vs All')
plt.xlabel('Student Growth Rating')
plt.legend();

plt.hist([subset_df.student_growth,not_subset_df.student_growth], stacked=True, density=True, color=["blue", "red"],range=(1,4), bins=4)
plt.title('Top 10 Neighborhood vs \n the rest')
plt.xlabel('Student Growth Rate')
plt.xlim(1,4,1)
plt.show()
sns.set(style="ticks")
g = sns.catplot(x='hardship_index', y='student_growth', data=final_df_categorical, order=['0th+', '25th+','50th+','75th+'])
plt.title('Student Growth Rate\nvs\nHardship Index')
plt.xlabel('Hardship Index')
plt.ylabel('Student Growth Rate')
g.fig.set_size_inches(10,8)
charter_df = final_df[final_df['school_type'] == 'Charter']
charter_df
final_df.loc[:,'student_growth'] = final_df.student_growth.astype(int)
final_df.student_growth.mean()
charter_df.student_growth.mean()
one_sample_ttest(charter_df.student_growth, final_df.student_growth.mean(), 0.05)
plt.title('Charter vs Non-Charter\nStudent Growth Rate')
plt.axvline(x=charter_df.student_growth.mean(), color='red')
plt.text(2.55,.16,'Charter\nmean\n2.349',rotation=0, color='red',horizontalalignment='center')
plt.axvline(x=final_df.student_growth.mean(), color='blue')
plt.text(1.65,.16,'Population\nmean\n1.932',color='blue',horizontalalignment='center')
plt.xlabel('Student Growth Rate');<jupyter_output>Null hypothesis rejected. Results are statistically significant with t-value = 3.49 critical t-value = 1.6819523559426 and p-value = 0.0011588387
{'fraction_non_alphanumeric': 0.17562346329469616, 'fraction_numerical': 0.04671584123638918, 'mean_word_length': 8.157556270096464, 'pattern_counts': {'":': 2, '<': 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': '652712', 'license': 'MIT', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1068, 'n_words': 168, 'path': 'David_v0.02.ipynb', 'repo_name': 'sydroth/ebaydata', 'size': '2847'}