<jupyter_start><jupyter_text>ContextIn this exercise, we will use the income-expenditure dataset(Inc_Exp_Data.csv) to obtain various descriptive statistical summary of the households. The income-expenditure dataset contains the income expenditure of the individuals having a family.  Data DescriptionThe income-expenditure dataset contains the 7 attributes of 50 individuals.1. **Mthly_HH_Income** - Monthly Household Income2. **Mthly_HH_Expense** - Monthly Household Expense3.	**No_of_Fly_Members** - Number of Family Members4.	**Emi_or_Rent_Amt** - Monthly EMI or Rent Amount5.	**Annual_HH_Income** - Annual Household Income6.	**Highest_Qualified_Member** - Education Level of the Highest Qualified Member in the household7.	**No_of_Earning_Members** - Number of Earning Members  1.Import necessary packages<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
pd.options.display.float_format = '{:,.2f}'.format<jupyter_output><empty_output><jupyter_text>2.Load the file<jupyter_code>inc_exp = pd.read_csv("Inc_Exp_Data.csv")<jupyter_output><empty_output><jupyter_text>3.Analyze the data (Obtain the Statistical Summary)<jupyter_code>inc_exp.head(10)
inc_exp.describe()<jupyter_output><empty_output><jupyter_text>4.What is the Mean Expense of a Household?<jupyter_code>inc_exp.Mthly_HH_Expense.mean()<jupyter_output><empty_output><jupyter_text>5.What is the Median Household Expense?<jupyter_code>inc_exp.Mthly_HH_Expense.median()<jupyter_output><empty_output><jupyter_text>6.What is the Monthly Expense for most of the Households?<jupyter_code>mth_exp_tmp = pd.crosstab(index=inc_exp["Mthly_HH_Expense"], columns="count")
mth_exp_tmp.reset_index(inplace=True)
mth_exp_tmp[mth_exp_tmp['count'] == inc_exp.Mthly_HH_Expense.value_counts().max()]<jupyter_output><empty_output><jupyter_text>7.Plot the Histogram to count the Highest qualified member<jupyter_code>inc_exp['Highest_Qualified_Member'].value_counts().plot(kind='bar')<jupyter_output><empty_output><jupyter_text>8.Calculate IQR(difference between 75% and 25% quartile) for Monthly Household Income and Expense<jupyter_code>inc_exp.plot(x="Mthly_HH_Income", y="Mthly_HH_Expense")
plt.show()
IQR_i = inc_exp["Mthly_HH_Income"].quantile(0.75) - inc_exp["Mthly_HH_Income"].quantile(0.25)
print("IQR for Monthly Household Income",IQR_i)
print()
IQR_e = inc_exp["Mthly_HH_Expense"].quantile(0.75) - inc_exp["Mthly_HH_Expense"].quantile(0.25)
print("IQR for Monthly Household Expense",IQR_e)<jupyter_output><empty_output><jupyter_text>9.Calculate Standard Deviation for first 4 columns.<jupyter_code>pd.DataFrame(inc_exp.iloc[:,0:4].std().to_frame()).T<jupyter_output><empty_output><jupyter_text>10.Calculate Variance for first 3 columns.<jupyter_code>pd.DataFrame(inc_exp.iloc[:,0:3].var().to_frame()).T<jupyter_output><empty_output><jupyter_text>11.Calculate the count of Highest qualified member.<jupyter_code>pd.DataFrame(inc_exp['Highest_Qualified_Member'].value_counts().to_frame()).T<jupyter_output><empty_output><jupyter_text>12.Plot the Histogram to count the No_of_Earning_Members<jupyter_code>inc_exp['No_of_Earning_Members'].value_counts().plot(kind='bar')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11658914728682171, 'fraction_numerical': 0.015503875968992248, 'mean_word_length': 9.577049180327869, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '428235', 'license': 'Apache-2.0', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1167, 'n_words': 202, 'path': '00 Statistical Learning/Basic Stats Practice Exercise Solution.ipynb', 'repo_name': 'senthilprabhut/DataScience', 'size': '3225'}