pandas.io.formats.style.Styler.use#

Styler.use(styles)[源代码]#

设置当前样式器上的样式。

可能使用来自 Styler.export

参数
stylesDict(字符串,任意)
要添加到Styler的属性列表。Dict键应仅包含:
  • “Apply”:样式器函数列表,通常添加 applyapplymap

  • “TABLE_ATTRIBUTES”:HTML属性,通常添加 set_table_attributes

  • “TABLE_STYLES”:css选择器和属性,通常添加 set_table_styles

  • “HIDE_INDEX”:索引是否隐藏,通常加上 hide_index ,或隐藏级别的布尔列表。

  • “Hide_Columns”:是否隐藏列标题,通常添加 hide_columns ,或隐藏级别的布尔列表。

  • “HIDE_INDEX_NAMES”:索引名称是否隐藏。

  • “HIDE_COLUMN_NAMES”:是否隐藏列标题名称。

  • “css”:使用的css类名。

退货
self造型师

参见

Styler.export

将非数据相关属性导出到当前样式器。

示例

>>> styler = DataFrame([[1, 2], [3, 4]]).style
>>> styler2 = DataFrame([[9, 9, 9]]).style
>>> styler.hide(axis=0).highlight_max(axis=1)  
>>> export = styler.export()
>>> styler2.use(export)