Returns a Styler object. Contains methods for building a styled HTML representation of the DataFrame. See Also -------- io.formats.style.Styler : Helps style a DataFrame or Series according to the data with HTML and CSS. Examples
(self)
| 1406 | |
| 1407 | @property |
| 1408 | def style(self) -> Styler: |
| 1409 | """ |
| 1410 | Returns a Styler object. |
| 1411 | |
| 1412 | Contains methods for building a styled HTML representation of the DataFrame. |
| 1413 | |
| 1414 | See Also |
| 1415 | -------- |
| 1416 | io.formats.style.Styler : Helps style a DataFrame or Series according to the |
| 1417 | data with HTML and CSS. |
| 1418 | |
| 1419 | Examples |
| 1420 | -------- |
| 1421 | >>> df = pd.DataFrame({"A": [1, 2, 3]}) |
| 1422 | >>> df.style # doctest: +SKIP |
| 1423 | |
| 1424 | Please see |
| 1425 | `Table Visualization <../../user_guide/style.ipynb>`_ for more examples. |
| 1426 | """ |
| 1427 | # Raise AttributeError so that inspect works even if jinja2 is not installed. |
| 1428 | has_jinja2 = import_optional_dependency("jinja2", errors="ignore") |
| 1429 | if not has_jinja2: |
| 1430 | raise AttributeError("The '.style' accessor requires jinja2") |
| 1431 | |
| 1432 | from pandas.io.formats.style import Styler |
| 1433 | |
| 1434 | return Styler(self) |
| 1435 | |
| 1436 | _shared_docs["items"] = r""" |
| 1437 | Iterate over (column name, Series) pairs. |
nothing calls this directly
no test coverage detected