I am trying to rename unnamed columns in my data frame. Value of the 1st row in this column is expected to become a name of that column. If a column doesn't contain Unnamed, its name should remain unchanged.
I try to achieve it this way:
for col in columns:
if 'Unnamed' in col:
df = df.rename(columns=df.iloc[0])
break
In this case each column is renamed. Any ideas what am I doing wrong?