This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make the necessary imports | |
import pandas as pd | |
from ydata_profiling import ProfileReport | |
# Load the data | |
df = pd.read_csv('data/adult.csv', na_values='?') | |
# Generate the report | |
profile = ProfileReport(df,title="Adult Census Profile") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat_cols = ['workclass', 'education', 'education.num', | |
'marital.status', 'occupation', 'relationship', 'race', | |
'sex', 'native.country', 'income'] | |
for col in cat_cols: | |
categories = df.groupby(col).size() | |
print(categories) | |
#workclass | |
#Federal-gov 960 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Load the data | |
df = pd.read_csv('data/adult.csv', na_values='?') | |
# Dataset Overview | |
df.head() # preview a sample | |
df.shape # number of observations and features | |
# (32561, 15) |