Python 如何将数据帧行调整为列
如何格式化df2,使列为min、max、std等,行为股票符号?使用日期框的转置: 您想添加Python 如何将数据帧行调整为列,python,pandas,dataframe,Python,Pandas,Dataframe,如何格式化df2,使列为min、max、std等,行为股票符号?使用日期框的转置: 您想添加 df2 = df.describe().T # this is the equivalent of df.describe().transpose() print df2 count mean std min 25% 50% 75% max aapl 665 0.195720 0.331271
df2 = df.describe().T # this is the equivalent of df.describe().transpose()
print df2
count mean std min 25% 50% 75% max
aapl 665 0.195720 0.331271 -0.284546 -0.089219 0.110605 0.501857 0.783157
dvn 665 0.202538 0.143291 -0.246586 0.104409 0.175463 0.286709 0.548577
xom 413 -0.049164 0.062285 -0.273573 -0.096234 -0.045035 -0.001124 0.060982
df2 = df.describe().T # this is the equivalent of df.describe().transpose()
print df2
count mean std min 25% 50% 75% max
aapl 665 0.195720 0.331271 -0.284546 -0.089219 0.110605 0.501857 0.783157
dvn 665 0.202538 0.143291 -0.246586 0.104409 0.175463 0.286709 0.548577
xom 413 -0.049164 0.062285 -0.273573 -0.096234 -0.045035 -0.001124 0.060982
df2 = df2.transpose()