for c in income.columns: if income[c].dtype == 'object': income[c] = income[c].astype('category')