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

Fixed docstring error with style.py, unknown parameter: {'text_color_threshold'} #48055

Merged
17 changes: 8 additions & 9 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2987,7 +2987,10 @@ def _get_numeric_subset_default(self):
name="background",
alt="text",
image_prefix="bg",
text_threshold="",
text_threshold="""text_color_threshold : float or int\n
Luminance threshold for determining text color in [0, 1]. Facilitates text\n
visibility across varying background colors. All text is dark if 0, and\n
light if 1, defaults to 0.408.""",
)
@Substitution(subset=subset)
def background_gradient(
Expand Down Expand Up @@ -3026,11 +3029,7 @@ def background_gradient(
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
with ``axis=None``.
%(subset)s
text_color_threshold : float or int
{text_threshold}
Luminance threshold for determining text color in [0, 1]. Facilitates text
visibility across varying background colors. All text is dark if 0, and
light if 1, defaults to 0.408.
{text_threshold}
vmin : float, optional
Minimum data value that corresponds to colormap minimum value.
If not specified the minimum value of the data (or gmap) will be used.
Expand Down Expand Up @@ -3147,7 +3146,7 @@ def background_gradient(
name="text",
alt="background",
image_prefix="tg",
text_threshold="This argument is ignored (only used in `background_gradient`).",
text_threshold="",
)
def text_gradient(
self,
Expand All @@ -3166,10 +3165,10 @@ def text_gradient(
return self.apply(
_background_gradient,
cmap=cmap,
subset=subset,
axis=axis,
low=low,
high=high,
axis=axis,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real reason, I believe I was trying to match the order of the parameters in the docstring.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind reverting this change for now (could be a follow up PR)? We want to avoid any potential unrelated behavior change as this was supposed to just adjust a docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a valid change, but can be easier to add it in a separate taregted PR after this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted the unnecessary changes

subset=subset,
vmin=vmin,
vmax=vmax,
gmap=gmap,
Expand Down