Skip to content

Commit aa8a3ba

Browse files
authored
DOC CLN: use color shared doc string (pandas-dev#45251)
1 parent ab5c5a3 commit aa8a3ba

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

pandas/io/formats/style.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,17 @@ def _mpl(func: Callable):
8585
####
8686
# Shared Doc Strings
8787

88-
subset = """
89-
subset : label, array-like, IndexSlice, optional
88+
subset = """subset : label, array-like, IndexSlice, optional
9089
A valid 2d input to `DataFrame.loc[<subset>]`, or, in the case of a 1d input
9190
or single key, to `DataFrame.loc[:, <subset>]` where the columns are
92-
prioritised, to limit ``data`` to *before* applying the function.
93-
"""
91+
prioritised, to limit ``data`` to *before* applying the function."""
9492

95-
props = """
96-
props : str, default None
97-
CSS properties to use for highlighting. If ``props`` is given, ``color``
98-
is not used.
99-
"""
93+
props = """props : str, default None
94+
CSS properties to use for highlighting. If ``props`` is given, ``color``
95+
is not used."""
96+
97+
color = """color : str, default 'yellow'
98+
Background color to use for highlighting."""
10099

101100
#
102101
###
@@ -3111,8 +3110,11 @@ def highlight_null(
31113110
----------
31123111
null_color : str, default 'red'
31133112
%(subset)s
3113+
31143114
.. versionadded:: 1.1.0
3115+
31153116
%(props)s
3117+
31163118
.. versionadded:: 1.3.0
31173119
31183120
Returns
@@ -3134,7 +3136,7 @@ def f(data: DataFrame, props: str) -> np.ndarray:
31343136
props = f"background-color: {null_color};"
31353137
return self.apply(f, axis=None, subset=subset, props=props)
31363138

3137-
@Substitution(subset=subset, props=props)
3139+
@Substitution(subset=subset, color=color, props=props)
31383140
def highlight_max(
31393141
self,
31403142
subset: Subset | None = None,
@@ -3148,13 +3150,13 @@ def highlight_max(
31483150
Parameters
31493151
----------
31503152
%(subset)s
3151-
color : str, default 'yellow'
3152-
Background color to use for highlighting.
3153+
%(color)s
31533154
axis : {0 or 'index', 1 or 'columns', None}, default 0
31543155
Apply to each column (``axis=0`` or ``'index'``), to each row
31553156
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
31563157
with ``axis=None``.
31573158
%(props)s
3159+
31583160
.. versionadded:: 1.3.0
31593161
31603162
Returns
@@ -3178,7 +3180,7 @@ def highlight_max(
31783180
props=props,
31793181
)
31803182

3181-
@Substitution(subset=subset, props=props)
3183+
@Substitution(subset=subset, color=color, props=props)
31823184
def highlight_min(
31833185
self,
31843186
subset: Subset | None = None,
@@ -3192,13 +3194,13 @@ def highlight_min(
31923194
Parameters
31933195
----------
31943196
%(subset)s
3195-
color : str, default 'yellow'
3196-
Background color to use for highlighting.
3197+
%(color)s
31973198
axis : {0 or 'index', 1 or 'columns', None}, default 0
31983199
Apply to each column (``axis=0`` or ``'index'``), to each row
31993200
(``axis=1`` or ``'columns'``), or to the entire DataFrame at once
32003201
with ``axis=None``.
32013202
%(props)s
3203+
32023204
.. versionadded:: 1.3.0
32033205
32043206
Returns
@@ -3222,7 +3224,7 @@ def highlight_min(
32223224
props=props,
32233225
)
32243226

3225-
@Substitution(subset=subset, props=props)
3227+
@Substitution(subset=subset, color=color, props=props)
32263228
def highlight_between(
32273229
self,
32283230
subset: Subset | None = None,
@@ -3241,8 +3243,7 @@ def highlight_between(
32413243
Parameters
32423244
----------
32433245
%(subset)s
3244-
color : str, default 'yellow'
3245-
Background color to use for highlighting.
3246+
%(color)s
32463247
axis : {0 or 'index', 1 or 'columns', None}, default 0
32473248
If ``left`` or ``right`` given as sequence, axis along which to apply those
32483249
boundaries. See examples.
@@ -3253,6 +3254,7 @@ def highlight_between(
32533254
inclusive : {'both', 'neither', 'left', 'right'}
32543255
Identify whether bounds are closed or open.
32553256
%(props)s
3257+
32563258
Returns
32573259
-------
32583260
self : Styler
@@ -3326,7 +3328,7 @@ def highlight_between(
33263328
inclusive=inclusive,
33273329
)
33283330

3329-
@Substitution(subset=subset, props=props)
3331+
@Substitution(subset=subset, color=color, props=props)
33303332
def highlight_quantile(
33313333
self,
33323334
subset: Subset | None = None,
@@ -3346,8 +3348,7 @@ def highlight_quantile(
33463348
Parameters
33473349
----------
33483350
%(subset)s
3349-
color : str, default 'yellow'
3350-
Background color to use for highlighting.
3351+
%(color)s
33513352
axis : {0 or 'index', 1 or 'columns', None}, default 0
33523353
Axis along which to determine and highlight quantiles. If ``None`` quantiles
33533354
are measured over the entire DataFrame. See examples.
@@ -3361,6 +3362,7 @@ def highlight_quantile(
33613362
inclusive : {'both', 'neither', 'left', 'right'}
33623363
Identify whether quantile bounds are closed or open.
33633364
%(props)s
3365+
33643366
Returns
33653367
-------
33663368
self : Styler

0 commit comments

Comments
 (0)