_property _DataFrame.T
返回转置。
import pandas as pddf = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'],'age':[18, 39, 22, 45],'price': [1.0, 2.0, 3.0, 4.0],'color': ['red', 'black', 'blue', 'red']}, index=['first', 'second', 'third', 'forth'])df.T---------------------------------------转置之前site age price colorfirst google 18 1.0 redsecond baidu 39 2.0 blackthird wiki 22 3.0 blueforth pandas 45 4.0 red---------------------------------------转置之后first second third forthsite google baidu wiki pandasage 18 39 22 45price 1 2 3 4color red black blue red
