python print 显示不全_pandas打印时显示全部行(Row)、全部列(Column,关闭省略显示)、单元格(Cell)显示不全...

基于python 2.7.6  pandas 0.23.4测试

一、显示全部列(Column)

print打印时,显示如下:

[3 rows x 12 columns]

day country_code ... up_response_invalid_error_count up_response_invalid_timeout_count

5 20200729 total ... 19820.0 87695.0

9 20200723 SV ... 385.0 291.0

23 20200723 TR ... 10485.0 1201.0

28 20200723 TH ... 187.0 267.0

30 20200723 TN ... 5238.0 2590.0

33 20200724 BF ... 17490.0 37003.0

43 20200724 BH ... 252.0 309.0

加上如下设置显示所有列:

importpandasaspd

pd.set_option('display.max_columns', None)

# 恢复

pd.reset_option('display.max_columns')

二、显示全部行(Row)

加上如下设置显示全部行:

importpandasaspd

pd.set_option('display.max_rows', None)

# 复原

pd.reset_option('display.max_rows')

三、Cell显示不全,超过50了

加上如下设置value的显示长度为100,默认为50:

importpandasaspd

pd.set_option('max_colwidth',100)

# 复原

pd.reset_option('max_colwidth')

根据自己的需要更改相应的设置即可。set_option()的所有属性:

Available options:

- display.[chop_threshold, colheader_justify, column_space, date_dayfirst,

date_yearfirst, encoding, expand_frame_repr, float_format, height, large_repr]

- display.latex.[escape, longtable, repr]

- display.[line_width, max_categories, max_columns, max_colwidth,

max_info_columns, max_info_rows, max_rows, max_seq_items, memory_usage,

mpl_style, multi_sparse, notebook_repr_html, pprint_nest_depth, precision,

show_dimensions]

- display.unicode.[ambiguous_as_wide, east_asian_width]

- display.[width]

- io.excel.xls.[writer]

- io.excel.xlsm.[writer]

- io.excel.xlsx.[writer]

- io.hdf.[default_format, dropna_table]

- mode.[chained_assignment, sim_interactive, use_inf_as_null]

Parameters

----------

pat : str

Regexp which should match a single option.

Note: partial matches are supported for convenience, but unless you use the

full option name (e.g. x.y.z.option_name), your code may break in future

versions if new options with similar names are introduced.

value :

new value of option.

Returns

-------

None

Raises

------

OptionError if no such option exists

Notes

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值