diff --git a/docs/pandas_style.md b/docs/pandas_style.md index 136cb553..ddc6f528 100644 --- a/docs/pandas_style.md +++ b/docs/pandas_style.md @@ -59,7 +59,7 @@ s.background_gradient(axis=None, cmap="YlOrRd") We can also choose how the data is formatted: ```{code-cell} -s.format("{:.3f}") +s.format("{:.3f}").format_index("{:.3f}") ``` ## Caption diff --git a/itables/sample_dfs.py b/itables/sample_dfs.py index 4de88d86..2cd0325d 100644 --- a/itables/sample_dfs.py +++ b/itables/sample_dfs.py @@ -390,6 +390,11 @@ def get_pandas_styler(): s = df.style s.background_gradient(axis=None, cmap="YlOrRd") s.format("{:.3f}") + try: + s.format_index("{:.3f}") + except AttributeError: + # Python 3.7 AttributeError: 'Styler' object has no attribute 'format_index' + pass s.set_caption( "A Pandas Styler object with background colors and tooltips" diff --git a/tests/test_documentation_notebooks_run.py b/tests/test_documentation_notebooks_run.py index cf9a35d3..4193047d 100644 --- a/tests/test_documentation_notebooks_run.py +++ b/tests/test_documentation_notebooks_run.py @@ -11,7 +11,7 @@ except ImportError: pl = None -pytestmark = pytest.mark.skipif(sys.version_info < (3, 7), reason="Require Python>=3.7") +pytestmark = pytest.mark.skipif(sys.version_info < (3, 8), reason="Require Python>=3.8") def list_doc_notebooks():