diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 838a34adeaf82..213cbc725af48 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -10955,12 +10955,17 @@ def any( # type: ignore[override] bool_only=None, skipna: bool = True, **kwargs, - ) -> Series: + ) -> Series | np.bool_ | bool: # error: Incompatible return value type (got "Union[Series, bool]", # expected "Series") - return self._logical_func( # type: ignore[return-value] + + result = self._logical_func( "any", nanops.nanany, axis, bool_only, skipna, **kwargs ) + if isinstance(result, (np.bool_, bool)): + return result + + return result.__finalize__(self, method="any") @doc(make_doc("all", ndim=2)) def all( diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index a76b6b94d719d..efab029dea8ef 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -410,7 +410,6 @@ # Reductions pytest.param( (pd.DataFrame, frame_data, operator.methodcaller("any")), - marks=not_implemented_mark, ), pytest.param( (pd.DataFrame, frame_data, operator.methodcaller("sum")),