1import pandas as pd
2df = pd.DataFrame({"A":[10, 11, 7, 8, 5],
3 "B":[21, 5, 32, 4, 6],
4 "C":[11, 21, 23, 7, 9],
5 "D":[1, 5, 3, 8, 6]},
6 index =["A1", "A2", "A3", "A4", "A5"])
7dataframe.swapaxes(axis1="index", axis2="columns")