class pandas.io.formats.style.Styler(data, precision=None, table_styles=None, uuid=None, caption=None, table_attributes=None, cell_ids=True)
[source]
Helps style a DataFrame or Series according to the data with HTML and CSS.
Parameters: |
|
---|
See also
DataFrame.style
Most styling will be done by passing style functions into Styler.apply
or Styler.applymap
. Style functions should return values with strings containing CSS 'attr: value'
that will be applied to the indicated cells.
If using in the Jupyter notebook, Styler has defined a _repr_html_
to automatically render itself. Otherwise call Styler.render to get the generated HTML.
CSS classes are attached to the generated HTML
index_name
and level<k>
where k
is its level in a MultiIndexrow_heading
row<n>
where n
is the numeric position of the rowlevel<k>
where k
is the level in a MultiIndexcol_heading
* col<n>
where n
is the numeric position of the column * evel<k>
where k
is the level in a MultiIndexblank
data
env | (Jinja2 jinja2.Environment) |
template | (Jinja2 Template) |
loader | (Jinja2 Loader) |
apply (self, func[, axis, subset]) | Apply a function column-wise, row-wise, or table-wise, updating the HTML representation with the result. |
applymap (self, func[, subset]) | Apply a function elementwise, updating the HTML representation with the result. |
background_gradient (self[, cmap, low, high, …]) | Color the background in a gradient according to the data in each column (optionally row). |
bar (self[, subset, axis, color, width, …]) | Draw bar chart in the cell backgrounds. |
clear (self) | Reset the styler, removing any previously applied styles. |
export (self) | Export the styles to applied to the current Styler. |
format (self, formatter[, subset]) | Format the text display value of cells. |
from_custom_template (searchpath, name) | Factory function for creating a subclass of Styler with a custom template and Jinja environment. |
hide_columns (self, subset) | Hide columns from rendering. |
hide_index (self) | Hide any indices from rendering. |
highlight_max (self[, subset, color, axis]) | Highlight the maximum by shading the background. |
highlight_min (self[, subset, color, axis]) | Highlight the minimum by shading the background. |
highlight_null (self[, null_color]) | Shade the background null_color for missing values. |
pipe (self, func, \*args, \*\*kwargs) | Apply func(self, *args, **kwargs) , and return the result. |
render (self, \*\*kwargs) | Render the built up styles to HTML. |
set_caption (self, caption) | Set the caption on a Styler |
set_precision (self, precision) | Set the precision used to render. |
set_properties (self[, subset]) | Convenience method for setting one or more non-data dependent properties or each cell. |
set_table_attributes (self, attributes) | Set the table attributes. |
set_table_styles (self, table_styles) | Set the table styles on a Styler. |
set_uuid (self, uuid) | Set the uuid for a Styler. |
to_excel (self, excel_writer[, sheet_name, …]) | Write Styler to an Excel sheet. |
use (self, styles) | Set the styles on the current Styler, possibly using styles from Styler.export . |
where (self, cond, value[, other, subset]) | Apply a function elementwise, updating the HTML representation with a style which is selected in accordance with the return value of a function. |
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.io.formats.style.Styler.html