From a1f214588cf25f916cc09cd96df92139ae173465 Mon Sep 17 00:00:00 2001 From: Joshua Bello Date: Thu, 11 Aug 2022 22:34:22 +0100 Subject: [PATCH 1/4] fixed docstring error with style.py unknown paramter 'text_color_threshold' --- pandas/io/formats/style.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index df246ad30d806..28f3022a3b7d9 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -2986,7 +2986,7 @@ 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\tlight if 1, defaults to 0.408.", ) @Substitution(subset=subset) def background_gradient( @@ -3025,11 +3025,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. @@ -3146,7 +3142,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, @@ -3165,10 +3161,10 @@ def text_gradient( return self.apply( _background_gradient, cmap=cmap, - subset=subset, - axis=axis, low=low, high=high, + axis=axis, + subset=subset, vmin=vmin, vmax=vmax, gmap=gmap, From 8fb7b098636fecf36a240c9a891b00e4d8f5fc2f Mon Sep 17 00:00:00 2001 From: joshuabello2550 Date: Fri, 12 Aug 2022 10:43:59 +0000 Subject: [PATCH 2/4] Fixed docstring error with style.py, unknown parameter: text_color_threshold --- pandas/io/formats/style.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index eda6dd0d3417e..f086907a802ca 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -2987,7 +2987,10 @@ def _get_numeric_subset_default(self): name="background", alt="text", image_prefix="bg", - 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\tlight if 1, defaults to 0.408.", + 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( From 23eb3127775d6839ff1bb88d0b7324323ccc19f8 Mon Sep 17 00:00:00 2001 From: joshuabello2550 <43732414+joshuabello2550@users.noreply.github.com> Date: Thu, 18 Aug 2022 06:25:28 -0700 Subject: [PATCH 3/4] Update style.py reverted unneeded changes --- pandas/io/formats/style.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index f086907a802ca..0b3daf32e138f 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -3134,10 +3134,10 @@ def background_gradient( axis=axis, low=low, high=high, - text_color_threshold=text_color_threshold, vmin=vmin, vmax=vmax, gmap=gmap, + text_only=True, ) return self From c2d9f2a253e1bbbcdd377be106dfcc9c8e1a9a67 Mon Sep 17 00:00:00 2001 From: joshuabello2550 <43732414+joshuabello2550@users.noreply.github.com> Date: Thu, 18 Aug 2022 06:33:56 -0700 Subject: [PATCH 4/4] Update style.py Revert unneeded changes --- pandas/io/formats/style.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 0b3daf32e138f..fe10d4e312a1e 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -3134,10 +3134,10 @@ def background_gradient( axis=axis, low=low, high=high, + text_color_threshold=text_color_threshold, vmin=vmin, vmax=vmax, gmap=gmap, - text_only=True, ) return self @@ -3165,10 +3165,10 @@ def text_gradient( return self.apply( _background_gradient, cmap=cmap, + subset=subset, + axis=axis, low=low, high=high, - axis=axis, - subset=subset, vmin=vmin, vmax=vmax, gmap=gmap,