<jupyter_start><jupyter_text>Importing data<jupyter_code>data = pd.read_csv ('../data/raw/adult.data')
data.head()<jupyter_output><empty_output><jupyter_text>Checking Columns, Range, Values, and Shape<jupyter_code>data.columns
data.index
data.values
data.shape<jupyter_output><empty_output><jupyter_text>Dropping and renaming columns<jupyter_code>#droping columns
df_clean1 = data.drop([' State-gov', '39', ' 77516', ' 13', ' 2174', ' 0', ' 40', 'Unnamed: 0', ' Never-married', ' Adm-clerical', ' Not-in-family'], axis=1)
df_clean1.head(-5)
#renaming columns
df_c2 = df_clean1.rename({' State-gov': 'Work Class',' <=50K':'Income', ' White':'Race', ' Adm-clerical': 'Occupation', ' Bachelors': 'Education Level', 
                          ' Never-married': 'Marital-Status', ' Male': 'Sex', ' Not-in-family': 'Relationship', ' United-States': 'Native-Country'}, axis=1)
df_c2.head()<jupyter_output><empty_output><jupyter_text>Checking for NaN's<jupyter_code>#checking for NaN's: no missing values
#df_c2.isnull()
#Checking for NaN's in individual rows
#for i in range(len(df_c2.index)) :
#     print(" Total NaN in row", i + 1, ":",
#           df_c2.iloc[i].isnull().sum())

print(" \nCount total NaN in a DataFrame : \n\n",
       df_c2.isnull().sum().sum())<jupyter_output>Count total NaN in a DataFrame : 

 0
{'fraction_non_alphanumeric': 0.18126428027418126, 'fraction_numerical': 0.02513328255902513, 'mean_word_length': 5.083333333333333, 'pattern_counts': {'":': 1, '<': 17, '<?xml version=': 0, '>': 16, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '414425', 'license': 'MIT', 'n_tokens_mistral': 530, 'n_tokens_neox': 489, 'n_words': 98, 'path': 'analysis/CleanData.ipynb', 'repo_name': 'data301-2021-summer2/project-group6-project', 'size': '1313'}