pandas.set_option

pandas.set_option(pat, value)
为pandas的设置选项指定新值,可用选项包括:

  • compute.[use_bottleneck, use_numexpr]
  • display.[chop_threshold, colheader_justify, column_space, date_dayfirst, date_yearfirst, encoding, expand_frame_repr, float_format]
  • display.html.[border, table_schema, use_mathjax]
  • display.[large_repr]
  • display.latex.[escape, longtable, multicolumn, multicolumn_format, multirow, repr]
  • display.[max_categories, max_columns, max_colwidth, max_info_columns, max_info_rows, max_rows, max_seq_items, memory_usage, multi_sparse, notebook_repr_html, pprint_nest_depth, precision, show_dimensions]
  • display.unicode.[ambiguous_as_wide, east_asian_width]
  • display.[width]
  • html.[border]
  • io.excel.xls.[writer]
  • io.excel.xlsm.[writer]
  • io.excel.xlsx.[writer]
  • io.hdf.[default_format, dropna_table]
  • io.parquet.[engine]
  • mode.[chained_assignment, sim_interactive, use_inf_as_na, use_inf_as_null]
  • plotting.matplotlib.[register_converters]

常用选项

名称 类型 含义
display.chop_threshold None or float 小于阈值的float将显示为0
display.max_columns int 最大列数,大于该值的将被显示为省略号
display.max_colwidth int 列宽度
display.width int 横向显示宽度
display.precisioin int 小数点后位数
display.date_dayfirst False 日期格式 19/05/2018
display.date_yearfist False 日期格式 2018/05/19
display.encoding UTF-8 字符集