I get this error
ValueError: Columns must be same length as key
My code is
all_columns=[ col for col, dt in y.dtypes.items() if dt == 'object']
df[all_columns] = df[all_columns].astype(str)
I have some columns which are in dict format. So I want to convert all those columns into proper string data type. Please tell me why I am getting this error, I am using the same column list on both sides, right?
> Answer : Duplicates columns in the dataframe resulted in this type of error. There are two columns with the same name.