Skip to content

Commit

Permalink
Format the index too (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 30, 2023
1 parent 6100ee3 commit 862e300
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/pandas_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions itables/sample_dfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_documentation_notebooks_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 862e300

Please sign in to comment.