Convert row names into a column in Pandas
You can do it in one line.
df.rename_axis("newhead").reset_index()
df.index.name = 'newhead'
df.reset_index(inplace=True)
yields
newhead head1 head2 head3
0 bar 32 3 100
1 bix 22 NaN NaN
2 foo 11 1 NaN
3 qux NaN 10 NaN
4 xoo NaN 2 20