Skip to content

Commit 09f4484

Browse files
joelostblomWillAyd
authored andcommitted
Document the behavior of axis=None with style.background_gradient (#25551)
1 parent a07c7b9 commit 09f4484

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

pandas/io/formats/style.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,10 @@ def apply(self, func, axis=0, subset=None, **kwargs):
576576
on ``axis``), and return an object with the same shape.
577577
Must return a DataFrame with identical index and
578578
column labels when ``axis=None``
579-
axis : int, str or None
580-
apply to each column (``axis=0`` or ``'index'``)
581-
or to each row (``axis=1`` or ``'columns'``) or
582-
to the entire DataFrame at once with ``axis=None``
579+
axis : {0 or 'index', 1 or 'columns', None}, default 0
580+
apply to each column (``axis=0`` or ``'index'``), to each row
581+
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
582+
with ``axis=None``.
583583
subset : IndexSlice
584584
a valid indexer to limit ``data`` to *before* applying the
585585
function. Consider using a pandas.IndexSlice
@@ -894,10 +894,12 @@ def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0,
894894
matplotlib colormap
895895
low, high : float
896896
compress the range by these values.
897-
axis : int or str
898-
1 or 'columns' for columnwise, 0 or 'index' for rowwise
897+
axis : {0 or 'index', 1 or 'columns', None}, default 0
898+
apply to each column (``axis=0`` or ``'index'``), to each row
899+
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
900+
with ``axis=None``.
899901
subset : IndexSlice
900-
a valid slice for ``data`` to limit the style application to
902+
a valid slice for ``data`` to limit the style application to.
901903
text_color_threshold : float or int
902904
luminance threshold for determining text color. Facilitates text
903905
visibility across varying background colors. From 0 to 1.
@@ -1081,10 +1083,10 @@ def bar(self, subset=None, axis=0, color='#d65f5f', width=100,
10811083
----------
10821084
subset : IndexSlice, optional
10831085
A valid slice for `data` to limit the style application to.
1084-
axis : int, str or None, default 0
1085-
Apply to each column (`axis=0` or `'index'`)
1086-
or to each row (`axis=1` or `'columns'`) or
1087-
to the entire DataFrame at once with `axis=None`.
1086+
axis : {0 or 'index', 1 or 'columns', None}, default 0
1087+
apply to each column (``axis=0`` or ``'index'``), to each row
1088+
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
1089+
with ``axis=None``.
10881090
color : str or 2-tuple/list
10891091
If a str is passed, the color is the same for both
10901092
negative and positive numbers. If 2-tuple/list is used, the
@@ -1149,11 +1151,12 @@ def highlight_max(self, subset=None, color='yellow', axis=0):
11491151
Parameters
11501152
----------
11511153
subset : IndexSlice, default None
1152-
a valid slice for ``data`` to limit the style application to
1154+
a valid slice for ``data`` to limit the style application to.
11531155
color : str, default 'yellow'
1154-
axis : int, str, or None; default 0
1155-
0 or 'index' for columnwise (default), 1 or 'columns' for rowwise,
1156-
or ``None`` for tablewise
1156+
axis : {0 or 'index', 1 or 'columns', None}, default 0
1157+
apply to each column (``axis=0`` or ``'index'``), to each row
1158+
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
1159+
with ``axis=None``.
11571160
11581161
Returns
11591162
-------
@@ -1169,11 +1172,12 @@ def highlight_min(self, subset=None, color='yellow', axis=0):
11691172
Parameters
11701173
----------
11711174
subset : IndexSlice, default None
1172-
a valid slice for ``data`` to limit the style application to
1175+
a valid slice for ``data`` to limit the style application to.
11731176
color : str, default 'yellow'
1174-
axis : int, str, or None; default 0
1175-
0 or 'index' for columnwise (default), 1 or 'columns' for rowwise,
1176-
or ``None`` for tablewise
1177+
axis : {0 or 'index', 1 or 'columns', None}, default 0
1178+
apply to each column (``axis=0`` or ``'index'``), to each row
1179+
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
1180+
with ``axis=None``.
11771181
11781182
Returns
11791183
-------

0 commit comments

Comments
 (0)