I wanted to respond and extend this post in order to stick together all the similar information about transpose. It was said to me that I have to make a separated question.
If you have a simple DF you have two default axis: 'index' and 'columns'. Then you can use methods or functions like this:
df1 = pd.DataFrame({'one' : [1., 2., 3., 4.], 'two' : [4., 3., 2., 1.]})
df1.T
df1.transpose()
df1.swapaxes(axis1= 'columns',axis2= 'index')
# Edit: adding examples
df1
Out[98]:
one two
0 1.0 4.0
1 2.0 3.0
2 3.0 2.0
3 4.0 1.0
df1.T
Out[99]:
0 1 2 3
one 1.0 2.0 3.0 4.0
two 4.0 3.0 2.0 1.0
df1.one
Out[100]:
0 1.0
1 2.0
2 3.0
3 4.0
Name: one, dtype: float64
df1.one.equals(df1.one.T)
Out[106]: True
But since Series have an 'index' axis but not a 'columns' axis how could be possible to transpose it?.
I hope this time I'm following all the SO recomendation about asking.