Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将数据帧行调整为列_Python_Pandas_Dataframe - Fatal编程技术网

Python 如何将数据帧行调整为列

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,使列为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 -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()