set column as category datatype code example Example: set column as category datatype df['Geography'] = df['Geography'].astype('category')