Skip to content

Commit 327af12

Browse files
DOC: fix EX03 errors in docstrings - pandas.io.formats.style.Styler: highlight_quantile, background_gradient, text_gradient (#56904)
DOC: fix EX03 errors in docstrings - pandas.io.formats.style.Styler: highlight_quantile, background_gradient, text_gradient Co-authored-by: Marc Garcia <[email protected]>
1 parent 84aca21 commit 327af12

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8484
pandas.io.formats.style.Styler.apply_index \
8585
pandas.io.formats.style.Styler.map_index \
8686
pandas.io.formats.style.Styler.format \
87-
pandas.io.formats.style.Styler.highlight_quantile \
88-
pandas.io.formats.style.Styler.background_gradient \
89-
pandas.io.formats.style.Styler.text_gradient
9087
RET=$(($RET + $?)) ; echo $MSG "DONE"
9188

9289
fi

pandas/io/formats/style.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -2952,17 +2952,17 @@ def background_gradient(
29522952
Setting a ``gmap`` and applying to all columns with another ``cmap``
29532953
29542954
>>> df.style.{name}_gradient(axis=0, gmap=df['Temp (c)'], cmap='YlOrRd')
2955-
... # doctest: +SKIP
2955+
... # doctest: +SKIP
29562956
29572957
.. figure:: ../../_static/style/{image_prefix}_gmap.png
29582958
29592959
Setting the gradient map for a dataframe (i.e. ``axis=None``), we need to
29602960
explicitly state ``subset`` to match the ``gmap`` shape
29612961
2962-
>>> gmap = np.array([[1,2,3], [2,3,4], [3,4,5]])
2963-
>>> df.style.{name}_gradient(axis=None, gmap=gmap,
2964-
... cmap='YlOrRd', subset=['Temp (c)', 'Rain (mm)', 'Wind (m/s)']
2965-
... ) # doctest: +SKIP
2962+
>>> gmap = np.array([[1, 2, 3], [2, 3, 4], [3, 4, 5]])
2963+
>>> df.style.{name}_gradient(
2964+
... axis=None, gmap=gmap, cmap='YlOrRd',
2965+
... subset=['Temp (c)', 'Rain (mm)', 'Wind (m/s)']) # doctest: +SKIP
29662966
29672967
.. figure:: ../../_static/style/{image_prefix}_axNone_gmap.png
29682968
"""
@@ -3510,22 +3510,23 @@ def highlight_quantile(
35103510
--------
35113511
Using ``axis=None`` and apply a quantile to all collective data
35123512
3513-
>>> df = pd.DataFrame(np.arange(10).reshape(2,5) + 1)
3513+
>>> df = pd.DataFrame(np.arange(10).reshape(2, 5) + 1)
35143514
>>> df.style.highlight_quantile(axis=None, q_left=0.8, color="#fffd75")
3515-
... # doctest: +SKIP
3515+
... # doctest: +SKIP
35163516
35173517
.. figure:: ../../_static/style/hq_axNone.png
35183518
35193519
Or highlight quantiles row-wise or column-wise, in this case by row-wise
35203520
35213521
>>> df.style.highlight_quantile(axis=1, q_left=0.8, color="#fffd75")
3522-
... # doctest: +SKIP
3522+
... # doctest: +SKIP
35233523
35243524
.. figure:: ../../_static/style/hq_ax1.png
35253525
35263526
Use ``props`` instead of default background coloring
35273527
3528-
>>> df.style.highlight_quantile(axis=None, q_left=0.2, q_right=0.8,
3528+
>>> df.style.highlight_quantile(
3529+
... axis=None, q_left=0.2, q_right=0.8,
35293530
... props='font-weight:bold;color:#e83e8c') # doctest: +SKIP
35303531
35313532
.. figure:: ../../_static/style/hq_props.png

0 commit comments

Comments
 (0)