Skip to content

Commit 4a2052e

Browse files
committed
Merge branch 'builtins' into range_builtin
# Conflicts: # pandas/io/formats/style.py
2 parents 7dbc684 + 4fdaaed commit 4a2052e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pandas/io/formats/style.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,12 +1631,12 @@ def highlight_null(
16311631
-------
16321632
self : Styler
16331633
"""
1634+
1635+
def f(data: DataFrame, props: str) -> np.ndarray:
1636+
return np.where(pd.isna(data).values, props, "")
1637+
16341638
return self.apply(
1635-
_Builtins._highlight_func,
1636-
axis=None,
1637-
subset=subset,
1638-
props=f"background-color: {null_color};",
1639-
highlight="null",
1639+
f, axis=None, subset=subset, props=f"background-color: {null_color};"
16401640
)
16411641

16421642
def highlight_max(
@@ -1662,12 +1662,12 @@ def highlight_max(
16621662
-------
16631663
self : Styler
16641664
"""
1665+
1666+
def f(data: FrameOrSeries, props: str) -> np.ndarray:
1667+
return np.where(data == np.nanmax(data.values), props, "")
1668+
16651669
return self.apply(
1666-
_Builtins._highlight_func,
1667-
axis=axis,
1668-
subset=subset,
1669-
props=f"background-color: {color};",
1670-
highlight="max",
1670+
f, axis=axis, subset=subset, props=f"background-color: {color};"
16711671
)
16721672

16731673
def highlight_min(
@@ -1693,12 +1693,12 @@ def highlight_min(
16931693
-------
16941694
self : Styler
16951695
"""
1696+
1697+
def f(data: FrameOrSeries, props: str) -> np.ndarray:
1698+
return np.where(data == np.nanmin(data.values), props, "")
1699+
16961700
return self.apply(
1697-
_Builtins._highlight_func,
1698-
axis=axis,
1699-
subset=subset,
1700-
props=f"background-color: {color};",
1701-
highlight="min",
1701+
f, axis=axis, subset=subset, props=f"background-color: {color};"
17021702
)
17031703

17041704
def highlight_range(

0 commit comments

Comments
 (0)