SCo*_*vin 20 python pretty-print pandas
这似乎是一个非常简单的问题,但是它让我绕过弯道.我确定它应该由RTFM解决,但我已经看了选项,我可以看到一个修复它.
我只想打印所有列的dtypes,目前我得到:
print df.dtypes
#>
Date         object
Selection    object
Result       object
...
profit    float64
PL        float64
cumPL     float64
Length: 11, dtype: object
我试过设置选项display.max_row,display.max_info_row,display.max_info_columns都无济于事.
我究竟做错了什么?
熊猫版= 0.13.1
更新:
事实证明,我是一个白痴,并没有display.max_row达到足够高的价值.
解决方案是:
pd.set_option('display.max_rows', 20)
小智 9
做这个:
with pd.option_context('display.max_rows', None, 'display.max_columns', None):
    print(df.dtypes)
小智 7
另一种解决方法是按dtype进行分组,如下所示:
x = df.columns.to_series().groupby(df.dtypes).groups
x
{dtype('object'): ['Date', 'Selection', 'Result'], dtype('float64'): ['profit', 'PL', 'cumPL']