image_output_2.png image_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

dataset = pd.read_csv('../input/census-data-set/Census Income Dataset.csv', na_values=[' ?'])

test_dataset = pd.read_csv('../input/census-test-dataset/Census Income Testset.csv', na_values=[' ?'])

def Income_bracket_binarization(feat_val):
    if feat_val == '<=50K':
        return 0
    else:
        return 1
dataset['Income_bracket'] = dataset['Income_bracket'].apply(Income_bracket_binarization)
test_dataset['Income_bracket'] = test_dataset['Income_bracket'].apply(Income_bracket_binarization)
dataset.head()