Jan-22-2020, 01:10 AM
Hi everyone,
I have a DF with roughly 700 columns. I'd like to create a loop which loops through columns updating dtype category columns to object columns.I have created this loop but is giving me an error. Can anyone help?
I have a DF with roughly 700 columns. I'd like to create a loop which loops through columns updating dtype category columns to object columns.I have created this loop but is giving me an error. Can anyone help?
for col in df.columns: col_type = df[col].dtype if col_type = category: df[col] = df[col].astype('object')Thanks