set rows to columns df panda code example
Example 1: first row as column df
df.rename(columns=df.iloc[0])
Example 2: promote a row in panda dataframe to header
df.columns = df.iloc[0]
df = df[1:]
df.rename(columns=df.iloc[0])
df.columns = df.iloc[0]
df = df[1:]