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
@@ -895,7 +895,8 @@ def background_gradient(self, cmap='PuBu', low=0, high=0, axis=0,
low, high : float
compress the range by these values.
axis : int or str
1 or 'columns' for columnwise, 0 or 'index' for rowwise
0 or 'index' for columnwise, 1 or 'columns' for rowwise, or
``None`` for tablewise
This conversation was marked as resolved by WillAyd

This comment has been minimized.

Copy link
@TomAugspurger

TomAugspurger Mar 5, 2019

Contributor

Our linter may complain about the lack of a period after tablewise. LGTM otherwise though.

This comment has been minimized.

Copy link
@WillAyd

WillAyd Mar 5, 2019

Member

There's actually a standard representation for axis you should use. Check the end of this section:

https://python-sprints.github.io/pandas/guide/pandas_docstring.html#section-3-parameters

This comment has been minimized.

Copy link
@WillAyd

WillAyd Mar 5, 2019

Member

Just to be clear I'm asking for the preceding line to reflect the standard. The description down here can clarify the behavior of None since that is what differs for this method

This comment has been minimized.

Copy link
@joelostblom

joelostblom Mar 5, 2019

Author Contributor

@WillAyd Thanks, I could rewrite similar to

axis : int, str, None
    {0 or ‘index’, 1 or ‘columns’, None}, default 0.

and change the two highlight functions the same way. My only worry would be that this less verbose version does not make it as clear as the previous wording that 'columns' actually means row-wise. Maybe copying the wording from apply and bar would be a solution?

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``

This comment has been minimized.

Copy link
@WillAyd

WillAyd Mar 5, 2019

Member

Sure - there's more freedom around the description so I think copying that over is fine. Just wanted to make sure we use the same type line as elsewhere as I think in the future we might LINT for that standard

This comment has been minimized.

Copy link
@joelostblom

joelostblom Mar 5, 2019

Author Contributor

@WillAyd Updated. I made a few additional changes to unify the axis docstrings in this file and modified punctuation.

subset : IndexSlice
a valid slice for ``data`` to limit the style application to
text_color_threshold : float or int
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.