Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the behavior of axis=None with style.background_gradient #25551

Merged
merged 7 commits into from
Mar 7, 2019
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,10 @@ def apply(self, func, axis=0, subset=None, **kwargs):
on ``axis``), and return an object with the same shape.
Must return a DataFrame with identical index and
column labels when ``axis=None``
axis : int, str or None
apply to each column (``axis=0`` or ``'index'``)
or to each row (``axis=1`` or ``'columns'``) or
to the entire DataFrame at once with ``axis=None``
axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0
apply to each column (``axis=0`` or ``'index'``), to each row
WillAyd marked this conversation as resolved.
Show resolved Hide resolved
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.
subset : IndexSlice
a valid indexer to limit ``data`` to *before* applying the
function. Consider using a pandas.IndexSlice
Expand Down Expand Up @@ -894,10 +894,12 @@ def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0,
matplotlib colormap
low, high : float
compress the range by these values.
axis : int or str
1 or 'columns' for columnwise, 0 or 'index' for rowwise
axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0
apply to each column (``axis=0`` or ``'index'``), to each row
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.
subset : IndexSlice
a valid slice for ``data`` to limit the style application to
a valid slice for ``data`` to limit the style application to.
text_color_threshold : float or int
luminance threshold for determining text color. Facilitates text
visibility across varying background colors. From 0 to 1.
Expand Down Expand Up @@ -1081,10 +1083,10 @@ def bar(self, subset=None, axis=0, color='#d65f5f', width=100,
----------
subset : IndexSlice, optional
A valid slice for `data` to limit the style application to.
axis : int, str or None, default 0
Apply to each column (`axis=0` or `'index'`)
or to each row (`axis=1` or `'columns'`) or
to the entire DataFrame at once with `axis=None`.
axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0
apply to each column (``axis=0`` or ``'index'``), to each row
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.
color : str or 2-tuple/list
If a str is passed, the color is the same for both
negative and positive numbers. If 2-tuple/list is used, the
Expand Down Expand Up @@ -1149,11 +1151,12 @@ def highlight_max(self, subset=None, color='yellow', axis=0):
Parameters
----------
subset : IndexSlice, default None
a valid slice for ``data`` to limit the style application to
a valid slice for ``data`` to limit the style application to.
color : str, default 'yellow'
axis : int, str, or None; default 0
0 or 'index' for columnwise (default), 1 or 'columns' for rowwise,
or ``None`` for tablewise
axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0
apply to each column (``axis=0`` or ``'index'``), to each row
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.

Returns
-------
Expand All @@ -1169,11 +1172,12 @@ def highlight_min(self, subset=None, color='yellow', axis=0):
Parameters
----------
subset : IndexSlice, default None
a valid slice for ``data`` to limit the style application to
a valid slice for ``data`` to limit the style application to.
color : str, default 'yellow'
axis : int, str, or None; default 0
0 or 'index' for columnwise (default), 1 or 'columns' for rowwise,
or ``None`` for tablewise
axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0
apply to each column (``axis=0`` or ``'index'``), to each row
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.

Returns
-------
Expand Down