<jupyter_start><jupyter_text>Question1<jupyter_code>pres = nsfg.ReadFemResp()<jupyter_output><empty_output><jupyter_text>Question2<jupyter_code>pres["agescrn"].value_counts().sort_index()<jupyter_output><empty_output><jupyter_text>Question3<jupyter_code>pres[pres.agescrn <= 25 ].numpregs.mean()<jupyter_output><empty_output><jupyter_text>Question4<jupyter_code>pres.fmarno
hist1 = thinkstats2.Hist(pres.fmarno, label='The Number of Marriage')
hist1
width = 0.5
thinkplot.Hist(hist1, width = width) 
thinkplot.Config(xlabel='Number of Marriage', ylabel='Frequency')<jupyter_output><empty_output><jupyter_text>Question5<jupyter_code>neverMarried = pres[pres.fmarno == 0]
married = pres[pres.fmarno > 0]
nMarried_hist = thinkstats2.Hist(neverMarried.totincr, label='Total Income for never Married')
Married_hist = thinkstats2.Hist(married.totincr, label='Total Income for Married')

thinkplot.PrePlot(2)
thinkplot.Hist(nMarried_hist, align='right', width=width)
thinkplot.Hist(Married_hist, align='left', width=width)
thinkplot.Config(xlabel='Value', ylabel='Frequency')<jupyter_output><empty_output><jupyter_text>Question6<jupyter_code>prestotincrNM = pres.totincr[pres.fmarno == 0] # min, max, std and var for neverMarried respondents
print('Min: ' + str(prestotincrNM.min()) + ', Max: ' + str(prestotincrNM.max()) + 
      ', Standard Deviation: ' + str(prestotincrNM.std()) + ', Variance: ' + str(prestotincrNM.var()) + 
      ', Mean: ' + str(prestotincrNM.mean()))
prestotincrM = pres.totincr[pres.fmarno > 0] # min, max, std and var for Married respondents
print('Min: ' + str(prestotincrM.min()) + ', Max: ' + str(prestotincrM.max()) + 
      ', Standard Deviation: ' + str(prestotincrM.std()) + ', Variance: ' + str(prestotincrM.var())
     + ', Mean: ' + str(prestotincrM.mean()))<jupyter_output>Min: 1, Max: 14, Standard Deviation: 3.714652495800761, Variance: 13.798643164558822, Mean: 9.495152690256907
{'fraction_non_alphanumeric': 0.15629900679560899, 'fraction_numerical': 0.038159958180867745, 'mean_word_length': 7.7, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '255903', 'license': 'MIT', 'n_tokens_mistral': 791, 'n_tokens_neox': 736, 'n_words': 100, 'path': 'CS240HW1.ipynb', 'repo_name': 'SharpThunder/CS240DataAnalysis', 'size': '1913'}