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 | |
#Local-gov 2093 | |
#Never-worked 7 | |
# (...) | |
#education | |
#10th 933 | |
#11th 1175 | |
#12th 433 | |
# (...) |