I have a df with rows appended to next to other row.
I want columns of the df to be alpha
,beta
,gamma
0 1 2 3 4 5
0 alpha beta gamma alpha beta gamma
1 a b c 1 2 3
Resultant df should be,
alpha beta gamma
0 a b c
1 1 2 3
I want my df's first rows to be the index of dataframe?
What i have tried:
I tried to make the first row as index.
new_header = df.iloc[0] #grab the first row for the header
df = df[1:] #take the data less the header row
df.columns = new_header