diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 81bd14629cfd3..5d523f59a46f8 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -1140,7 +1140,7 @@ def clear(self) -> None: def _apply( self, - func: Callable[..., Styler], + func: Callable, axis: Axis | None = 0, subset: Subset | None = None, **kwargs, @@ -1195,7 +1195,7 @@ def _apply( def apply( self, - func: Callable[..., Styler], + func: Callable, axis: Axis | None = 0, subset: Subset | None = None, **kwargs, @@ -1290,7 +1290,7 @@ def apply( def _apply_index( self, - func: Callable[..., Styler], + func: Callable, axis: int | str = 0, level: Level | list[Level] | None = None, method: str = "apply", @@ -1325,7 +1325,7 @@ def _apply_index( ) def apply_index( self, - func: Callable[..., Styler], + func: Callable, axis: int | str = 0, level: Level | list[Level] | None = None, **kwargs, @@ -1411,7 +1411,7 @@ def apply_index( ) def applymap_index( self, - func: Callable[..., Styler], + func: Callable, axis: int | str = 0, level: Level | list[Level] | None = None, **kwargs, @@ -2597,11 +2597,7 @@ def f(data: DataFrame, props: str) -> np.ndarray: if props is None: props = f"background-color: {null_color};" - # error: Argument 1 to "apply" of "Styler" has incompatible type - # "Callable[[DataFrame, str], ndarray]"; expected "Callable[..., Styler]" - return self.apply( - f, axis=None, subset=subset, props=props # type: ignore[arg-type] - ) + return self.apply(f, axis=None, subset=subset, props=props) def highlight_max( self, @@ -2645,10 +2641,8 @@ def highlight_max( if props is None: props = f"background-color: {color};" - # error: Argument 1 to "apply" of "Styler" has incompatible type - # "Callable[[FrameOrSeries, str], ndarray]"; expected "Callable[..., Styler]" return self.apply( - partial(_highlight_value, op="max"), # type: ignore[arg-type] + partial(_highlight_value, op="max"), axis=axis, subset=subset, props=props, @@ -2696,10 +2690,8 @@ def highlight_min( if props is None: props = f"background-color: {color};" - # error: Argument 1 to "apply" of "Styler" has incompatible type - # "Callable[[FrameOrSeries, str], ndarray]"; expected "Callable[..., Styler]" return self.apply( - partial(_highlight_value, op="min"), # type: ignore[arg-type] + partial(_highlight_value, op="min"), axis=axis, subset=subset, props=props, @@ -2805,7 +2797,7 @@ def highlight_between( if props is None: props = f"background-color: {color};" return self.apply( - _highlight_between, # type: ignore[arg-type] + _highlight_between, axis=axis, subset=subset, props=props, @@ -2911,7 +2903,7 @@ def highlight_quantile( if props is None: props = f"background-color: {color};" return self.apply( - _highlight_between, # type: ignore[arg-type] + _highlight_between, axis=axis_apply, subset=subset, props=props,