pandas.get_option

pandas.get_option(pat) = <pandas.core.config.CallableDynamicDoc object>

检索指定选项的值。

可用选项:

  • 显示。[chop_threshold,colheader_justify,column_space,date_dayfirst,date_yearfirst,encoding,expand_frame_repr,float_format,height,large_repr]
  • display.latex。[escape,longtable,repr]
  • 显示。[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]
  • 显示。[宽度]
  • html。[边境]
  • io.excel.xls。[作家]
  • io.excel.xlsm。[作家]
  • io.excel.xlsx。[作家]
  • io.hdf。[default_format,dropna_table]
  • 模式。[chained_assignment,sim_interactive,use_inf_as_null]
参数:

pat:str

正则表达式应该匹配单个选项。注意:为方便起见,部分匹配是受支持的,但除非您使用完整选项名称(例如x.y.z.option_name),否则如果引入了类似名称的新选项,您的代码可能会在将来的版本中崩溃。

返回:

result:选项的值

上升:

OptionError:如果不存在此选项

笔记

可用选项及其说明:

display.chop_threshold
float或无
如果设置为浮点值,小于给定阈值的所有浮点值将由repr和friends显示为0。[默认:无] [当前:无]
display.colheader_justify
'left'/'right'
控制列标题的对齐方式。用于DataFrameFormatter。[default:right] [current:right]
display.column_space没有可用的描述。
[默认值:12] [当前:12]
display.date_dayfirst
boolean
当为True时,打印和解析日期以天为前,例如20/01/2005 [默认:False] [当前:False]
display.date_yearfirst
boolean
当为True时,以年为单位打印和解析日期,例如2005/01/20 [default:False] [current:False]
display.encoding
str / unicode
默认为检测到的控制台的编码。指定要用于to_string返回的字符串的编码,这些字符串通常是要显示在控制台上的字符串。[default:UTF-8] [current:UTF-8]
display.expand_frame_repr
boolean
是否打印出跨多行的宽数据帧的完整DataFrame repr,max_columns仍然受到尊重,但如果其宽度超过,输出将环绕多个“页面”display.width 。[default:True] [current:True]
display.float_format
callable
callable应该接受一个浮点数并返回一个具有所需数字格式的字符串。这在一些地方如SeriesFormatter中使用。有关示例,请参见formats.format.EngFormatter。[默认:无] [当前:无]
display.height
int
已弃用。[default:60] [current:15](不推荐使用display.max_rows)。
display.large_repr
'truncate'/'info'
对于超过max_rows / max_cols的DataFrames,repr(和HTML repr)可以显示截断表(默认值为0.13),或者从df.info()(早期版本的pandas中的行为)切换到视图。[default:truncate] [current:truncate]
display.latex.escape
bool
这指定了Dataframe的to_latex方法是否使用转义特殊字符。方法。有效值:False,True [默认值:True] [当前:True]
display.latex.longtable:bool
这指定Dataframe的to_latex方法是否使用longtable格式。方法。有效值:False,True [默认值:False] [当前:False]
display.latex.repr
boolean
是否为支持它的jupyter环境生成一个乳胶DataFrame表示。(默认值:False)[默认值:False] [当前:False]
display.line_width
int
已弃用。[default:80] [current:80](不推荐使用display.width)。
display.max_categories
int
这将设置打印输出分类或一系列dtype“类别”时pandas应输出的类别的最大数量。[默认值:8] [当前:8]
display.max_columns
int

如果超过max_cols,请切换到截断视图。根据large_repr,对象将被中央截断或打印为摘要视图。“无”值意味着无限。

如果python / IPython在终端中运行,并且large_repr等于'truncate',则可以将其设置为0,并且pandas将自动检测终端的宽度,并打印适合屏幕宽度的截断对象。IPython笔记本,IPython qtconsole或IDLE不在终端中运行,因此无法进行正确的自动检测。[默认值:20] [当前:20]

display.max_colwidth
int
pandas数据结构的repr中的列的最大字符宽度。当列溢出时,在输出中嵌入一个“...”占位符。[默认值:50] [当前:50]
display.max_info_columns
int
max_info_columns用于DataFrame.info方法中,以确定是否将打印每列信息。[默认值:100] [当前:100]
display.max_info_rows
int或无
df.info()通常会显示每个列的空值。对于大型帧,这可能会很慢。max_info_rows和max_info_cols仅将此空检查限制到具有比指定的更小的尺寸的帧。[默认值:1690785] [当前:1690785]
display.max_rows
int

如果超过max_rows,请切换到截断视图。根据large_repr,对象将被中央截断或打印为摘要视图。“无”值意味着无限。

如果python / IPython在终端中运行,并且large_repr等于'truncate',则可以将其设置为0,并且pandas将自动检测终端的高度,并打印适合屏幕高度的截断对象。IPython笔记本,IPython qtconsole或IDLE不在终端中运行,因此无法进行正确的自动检测。[默认值:60] [当前:15]

display.max_seq_items
int或无

当漂亮打印一个长序列时,不会再打印max_seq_items如果省略项目,则通过向生成的字符串添加“...”来表示。

如果设置为无,则要打印的项目数不受限制。[默认值:100] [当前:100]

display.memory_usage
bool,string或None
这指定在调用df.info()时是否应显示DataFrame的内存使用情况。有效值True,False,'deep'[默认值:True] [当前:True]
display.mpl_style
bool
将此设置为“默认”将修改由matplotlib使用的rcParams,以在默认情况下给绘图更令人愉快的视觉样式。将此值设置为无/ False将将值恢复为其初始值。[默认:无] [当前:无]
display.multi_sparse
boolean
“sparsify”MultiIndex显示(不在组内的外层中显示重复的元素)[default:True] [current:True]
display.notebook_repr_html
boolean
当为True时,IPython笔记本将使用html表示形式的pandas对象(如果可用)。[default:True] [current:True]
display.pprint_nest_depth
int
控制漂亮打印时要处理的嵌套级别数[默认值:3] [当前:3]
display.precision
int
浮点输出精度(有效数字位数)。这只是一个建议[默认值:6] [当前:6]
display.show_dimensions
boolean或'truncate'
是否在DataFrame repr结尾打印尺寸。如果指定了'truncate',则只有当帧被截断时才打印出尺寸(例如,不显示所有行和/或列)[default:truncate] [current:truncate]
display.unicode.ambiguous_as_wide
boolean
是否使用Unicode东亚宽度来计算显示文本宽度。启用此选项可能会影响性能(默认值:False)[默认值:False] [当前:False]
display.unicode.east_asian_width
boolean
是否使用Unicode东亚宽度来计算显示文本宽度。启用此选项可能会影响性能(默认值:False)[默认值:False] [当前:False]
display.width
int
显示的宽度(以字符为单位)。如果python / IPython在终端中运行,这可以设置为None,并且pandas将正确地自动检测宽度。请注意,IPython notebook,IPython qtconsole或IDLE不会在终端中运行,因此无法正确检测宽度。[default:80] [current:80]
html.border
int
在DataFrame HTML代码的<table>标记中插入border=value属性。[默认值:1] [当前:1]
io.excel.xls.writer
string
'xls'文件的默认Excel writer引擎。可用选项:'xlwt'(默认值)。[default:xlwt] [current:xlwt]
io.excel.xlsm.writer
string
'xlsm'文件的默认Excel写入器引擎。可用选项:'openpyxl'(默认值)。[default:openpyxl] [current:openpyxl]
io.excel.xlsx.writer
string
'xlsx'文件的默认Excel写入器引擎。可用选项:'xlsxwriter'(默认值),'openpyxl'。[default:xlsxwriter] [current:xlsxwriter]
io.hdf.default_format
格式
默认格式写入格式,如果无,则put将默认为'fixed',append将默认为'table'[默认:None] [当前:无]
io.hdf.dropna_table
boolean
在追加到表时删除所有的行[默认值:False] [当前:False]
mode.chained_assignment
string
如果尝试使用链接分配,则引发异常,警告或无操作,默认值为warn [default:warn] [current:warn]
mode.sim_interactive
boolean
是否为了测试目的模拟交互模式[默认:False] [当前:False]
mode.use_inf_as_null
boolean
True表示无,NaN,INF,-INF为空(旧方式),False表示无,NaN为空,但INF,-INF不为空(新方式)。[default:False] [current:False]
Scroll To Top