I would like to change my DataFrame index column with the df.set_index() function. While this provides a functional solution, it creates an "extra" row that I would like to get rid of.
df = pd.DataFrame({'A': ['a','b','c'], 'B': ['d','e','f'], 'C': [1,2,3]})
df looks like this:
A B C
0 a d 1
1 b e 2
2 c f 3
Changing the DataFrame index:
df.set_index('C')
Result:
A B
C
1 a e
2 b f
3 c g
How can I make the dataframe look as follows?
C A B
1 a e
2 b f
3 c g
I saw a similar question here but the solution using reset_index() did not provide the desired result. I would like to keep the values I have on column C and only remove the extra row.