Pandas有五个自定义其行为的函数:
print ("display.max_rows = ", pd.get_option("display.max_rows"))
# display.max_rows = 60 - 显示上限的行
print ("display.max_rows = ", pd.get_option("display.max_columns"))
# display.max_rows = 20 - 显示上限的列
print ("before set display.max_rows = ", pd.get_option("display.max_rows"))
pd.set_option("display.max_rows",80)
print ("after set display.max_rows = ", pd.get_option("display.max_rows"))
# before set display.max_rows = 60
# after set display.max_rows = 80
pd.set_option("display.max_rows",32)
print ("after set display.max_rows = ", pd.get_option("display.max_rows"))
pd.reset_option("display.max_rows")
print ("reset display.max_rows = ", pd.get_option("display.max_rows"))
# after set display.max_rows = 32
# reset display.max_rows = 60
pd.describe_option("display.max_rows")
'''
display.max_rows : int
If max_rows is exceeded, switch to truncate view. Depending on
`large_repr`, objects are either centrally truncated or printed as
a summary view. 'None' value means unlimited.
In case python/IPython is running in a terminal and `large_repr`
equals 'truncate' this can be set to 0 and pandas will auto-detect
the height of the terminal and print a truncated object which fits
the screen height. The IPython notebook, IPython qtconsole, or
IDLE do not run in a terminal and hence it is not possible to do
correct auto-detection.
[default: 60] [currently: 60]
'''
with pd.option_context("display.max_rows",10):
print(pd.get_option("display.max_rows"))
print(pd.get_option("display.max_rows"))
# 10
# 60
参数 | 描述 |
---|---|
display.max_rows | 显示的最大行数 |
display.max_columns | 显示的最大列数 |
display.expend_frame_repr | 显示数据帧以拉伸页面 |
display.max_colwidth | 显示最大列宽 |
display.precision | 显示十进制数的精度 |