@@ -476,7 +476,7 @@ def set_tooltips(
476
476
477
477
>>> df = pd.DataFrame(data=[[0, 1], [2, 3]])
478
478
>>> ttips = pd.DataFrame(
479
- ... data=[["Min", ""], [np.nan, "Max"]], columns=df.columns, index=df.index
479
+ ... data=[["Min", ""], [np.nan, "Max"]], columns=df.columns, index=df.index
480
480
... )
481
481
>>> s = df.style.set_tooltips(ttips).to_html()
482
482
@@ -486,7 +486,8 @@ def set_tooltips(
486
486
... ('visibility', 'hidden'),
487
487
... ('position', 'absolute'),
488
488
... ('z-index', 1)]) # doctest: +SKIP
489
- >>> df.style.set_tooltips(ttips, css_class='tt-add',
489
+ >>> df.style.set_tooltips(
490
+ ... ttips, css_class='tt-add',
490
491
... props='visibility:hidden; position:absolute; z-index:1;')
491
492
... # doctest: +SKIP
492
493
"""
@@ -2305,8 +2306,8 @@ def set_uuid(self, uuid: str) -> Styler:
2305
2306
2306
2307
To add a title to column `c1`, its `id` is T_20a7d_level0_col0:
2307
2308
2308
- >>> df.style.set_uuid("T_20a7d_level0_col0")
2309
- ... .set_caption("Test") # doctest: +SKIP
2309
+ >>> df.style.set_uuid("T_20a7d_level0_col0").set_caption("Test")
2310
+ ... # doctest: +SKIP
2310
2311
2311
2312
Please see:
2312
2313
`Table visualization <../../user_guide/style.ipynb>`_ for more examples.
@@ -3418,21 +3419,23 @@ def highlight_between(
3418
3419
and ``right`` for each column individually
3419
3420
3420
3421
>>> df.style.highlight_between(left=[1.4, 2.4, 3.4], right=[1.6, 2.6, 3.6],
3421
- ... axis=1, color="#fffd75") # doctest: +SKIP
3422
+ ... axis=1, color="#fffd75") # doctest: +SKIP
3422
3423
3423
3424
.. figure:: ../../_static/style/hbetw_seq.png
3424
3425
3425
3426
Using ``axis=None`` and providing the ``left`` argument as an array that
3426
3427
matches the input DataFrame, with a constant ``right``
3427
3428
3428
- >>> df.style.highlight_between(left=[[2,2,3],[2,2,3],[3,3,3]], right=3.5,
3429
+ >>> df.style.highlight_between(
3430
+ ... left=[[2, 2, 3], [2, 2, 3], [3, 3, 3]], right=3.5,
3429
3431
... axis=None, color="#fffd75") # doctest: +SKIP
3430
3432
3431
3433
.. figure:: ../../_static/style/hbetw_axNone.png
3432
3434
3433
3435
Using ``props`` instead of default background coloring
3434
3436
3435
- >>> df.style.highlight_between(left=1.5, right=3.5,
3437
+ >>> df.style.highlight_between(
3438
+ ... left=1.5, right=3.5,
3436
3439
... props='font-weight:bold;color:#e83e8c') # doctest: +SKIP
3437
3440
3438
3441
.. figure:: ../../_static/style/hbetw_props.png
@@ -3699,10 +3702,10 @@ def pipe(
3699
3702
can be easily applied to a generic styler in a single ``pipe`` call.
3700
3703
3701
3704
>>> def some_highlights(styler, min_color="red", max_color="blue"):
3702
- ... styler.highlight_min(color=min_color, axis=None)
3703
- ... styler.highlight_max(color=max_color, axis=None)
3704
- ... styler.highlight_null()
3705
- ... return styler
3705
+ ... styler.highlight_min(color=min_color, axis=None)
3706
+ ... styler.highlight_max(color=max_color, axis=None)
3707
+ ... styler.highlight_null()
3708
+ ... return styler
3706
3709
>>> df = pd.DataFrame([[1, 2, 3, pd.NA], [pd.NA, 4, 5, 6]], dtype="Int64")
3707
3710
>>> df.style.pipe(some_highlights, min_color="green") # doctest: +SKIP
3708
3711
@@ -3712,8 +3715,8 @@ def pipe(
3712
3715
methods as if applying the underlying highlighters directly.
3713
3716
3714
3717
>>> (df.style.format("{:.1f}")
3715
- ... .pipe(some_highlights, min_color="green")
3716
- ... .highlight_between(left=2, right=5)) # doctest: +SKIP
3718
+ ... .pipe(some_highlights, min_color="green")
3719
+ ... .highlight_between(left=2, right=5)) # doctest: +SKIP
3717
3720
3718
3721
.. figure:: ../../_static/style/df_pipe_hl2.png
3719
3722
@@ -3733,7 +3736,7 @@ def pipe(
3733
3736
>>> def highlight_last_level(styler):
3734
3737
... return styler.apply_index(
3735
3738
... lambda v: "background-color: pink; color: yellow", axis="columns",
3736
- ... level=styler.columns.nlevels- 1
3739
+ ... level=styler.columns.nlevels - 1
3737
3740
... ) # doctest: +SKIP
3738
3741
>>> df.columns = pd.MultiIndex.from_product([["A", "B"], ["X", "Y"]])
3739
3742
>>> df.style.pipe(highlight_last_level) # doctest: +SKIP
0 commit comments