Check out example codes for "flip exis in dataframe". It will help you in understanding the concepts better.

Code Example 1

>>> df1_transposed = df1.T # or df1.transpose()
>>> df1_transposed
      0  1
col1  1  2
col2  3  4

Learn ReactJs, React Native from akashmittal.com