樣式#

Styler 物件由 pandas.DataFrame.style 傳回。

Styler 建構函式#

Styler(data[, precision, table_styles, ...])

協助根據資料使用 HTML 和 CSS 來設定 DataFrame 或 Series 的樣式。

Styler.from_custom_template(searchpath[, ...])

用於建立 Styler 子類別的工廠函式。

Styler 屬性#

Styler.env

Styler.template_html

Styler.template_html_style

Styler.template_html_table

Styler.template_latex

Styler.template_string

Styler.loader

樣式應用#

Styler.apply(func[, axis, subset])

按欄、按列或按表格應用 CSS 樣式功能。

Styler.map(func[, subset])

按元素應用 CSS 樣式功能。

Styler.apply_index(func[, axis, level])

按層級對索引或欄標題應用 CSS 樣式功能。

Styler.map_index(func[, axis, level])

按元素對索引或欄標題應用 CSS 樣式功能。

Styler.format([formatter, subset, na_rep, ...])

設定儲存格文字顯示值的格式。

Styler.format_index([formatter, axis, ...])

設定索引標籤或欄標題文字顯示值的格式。

Styler.relabel_index(labels[, axis, level])

重新標記索引或欄標題鍵,以顯示一組指定的值。

Styler.hide([subset, axis, level, names])

隱藏整個索引/欄位標題或特定列/欄位不顯示。

Styler.concat(other)

附加另一個 Styler,將輸出合併成一個表格。

Styler.set_td_classes(classes)

設定 class 屬性為 <td> HTML 元素。

Styler.set_table_styles([table_styles, ...])

設定包含在 <style> HTML 元素內的表格樣式。

Styler.set_table_attributes(attributes)

設定新增到 <table> HTML 元素的表格屬性。

Styler.set_tooltips(ttips[, props, css_class])

設定 Styler 上的字串 DataFrame,產生 :hover 工具提示。

Styler.set_caption(caption)

設定新增到 <caption> HTML 元素的文字。

Styler.set_sticky([axis, pixel_size, levels])

新增 CSS,以在捲動框架中永久顯示索引或欄位標頭。

Styler.set_properties([subset])

針對給定的子集,設定每個 <td> HTML 元素的已定義 CSS 屬性。

Styler.set_uuid(uuid)

設定套用至 HTML 元素的 id 屬性的 uuid。

Styler.clear()

重設 Styler,移除先前套用的任何樣式。

Styler.pipe(func, *args, **kwargs)

套用 func(self, *args, **kwargs),並傳回結果。

內建樣式#

Styler.highlight_null([color, subset, props])

以樣式突顯遺失值。

Styler.highlight_max([subset, color, axis, ...])

以樣式突顯最大值。

Styler.highlight_min([subset, color, axis, ...])

以樣式突顯最小值。

Styler.highlight_between([subset, color, ...])

以樣式突顯已定義的範圍。

Styler.highlight_quantile([subset, color, ...])

以樣式突顯由分位數定義的值。

Styler.background_gradient([cmap, low, ...])

以漸層樣式填滿背景。

Styler.text_gradient([cmap, low, high, ...])

以漸層樣式填滿文字。

Styler.bar([subset, axis, color, cmap, ...])

在儲存格背景中繪製長條圖。

樣式匯出與匯入#

Styler.to_html([buf, table_uuid, ...])

將 Styler 寫入 HTML-CSS 格式的檔案、緩衝區或字串。

Styler.to_latex([buf, column_format, ...])

將 Styler 寫入 LaTeX 格式的檔案、緩衝區或字串。

Styler.to_excel(excel_writer[, sheet_name, ...])

將 Styler 寫入 Excel 工作表。

Styler.to_string([buf, encoding, ...])

將 Styler 寫入文字格式的檔案、緩衝區或字串。

Styler.export()

匯出套用到目前 Styler 的樣式。

Styler.use(styles)

設定目前 Styler 的樣式。