Repository: pandas-dev/pandas
File: pandas/core/arrays/masked.py (Python)

Code before:
        nv.validate_min((), kwargs)
        result = masked_reductions.min(
            self._data,
            self._mask,
            skipna=skipna,
            axis=axis,
        )
        return self._wrap_reduction_result("min", result, skipna=skipna, axis=axis)

    def max(self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs):
        nv.validate_max((), kwargs)
        result = masked_reductions.max(
            self._data,
            self._mask,
            skipna=skipna,
            axis=axis,
        )
        return self._wrap_reduction_result("max", result, skipna=skipna, axis=axis)

    def map(self, mapper, na_action: Literal["ignore"] | None = None):
        result = map_array(
            self.to_numpy(dtype=object, na_value=libmissing.NA),
            mapper,
            na_action=na_action,
        )
        if isinstance(result, np.ndarray):
            return self._cast_pointwise_result(result)
        return result

    @overload
    def any(
        self, *, skipna: Literal[True] = ..., axis: AxisInt | None = ..., **kwargs
    ) -> np.bool_: ...

    @overload
    def any(
        self, *, skipna: bool, axis: AxisInt | None = ..., **kwargs
    ) -> np.bool_ | NAType: ...

    def any(
        self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs
    ) -> np.bool_ | NAType:
        """
        Return whether any element is truthy.

        Returns False unless there is at least one element that is truthy.
        By default, NAs are skipped. If ``skipna=False`` is specified and
        missing values are present, similar :ref:`Kleene logic <boolean.kleene>`
        is used as for logical operations.

        Parameters

Review comment (suggestion):
I think this should always be a NumPy array; can you check? Change this to `assert isinstance(result, np.ndarray)` and see that tests still pass.

Code after:
        nv.validate_min((), kwargs)
        result = masked_reductions.min(
            self._data,
            self._mask,
            skipna=skipna,
            axis=axis,
        )
        return self._wrap_reduction_result("min", result, skipna=skipna, axis=axis)

    def max(self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs):
        nv.validate_max((), kwargs)
        result = masked_reductions.max(
            self._data,
            self._mask,
            skipna=skipna,
            axis=axis,
        )
        return self._wrap_reduction_result("max", result, skipna=skipna, axis=axis)

    def map(self, mapper, na_action: Literal["ignore"] | None = None):
        result = map_array(
            self.to_numpy(dtype=object, na_value=libmissing.NA),
            mapper,
            na_action=na_action,
        )
        return self._cast_pointwise_result(result)

    @overload
    def any(
        self, *, skipna: Literal[True] = ..., axis: AxisInt | None = ..., **kwargs
    ) -> np.bool_: ...

    @overload
    def any(
        self, *, skipna: bool, axis: AxisInt | None = ..., **kwargs
    ) -> np.bool_ | NAType: ...

    def any(
        self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs
    ) -> np.bool_ | NAType:
        """
        Return whether any element is truthy.

        Returns False unless there is at least one element that is truthy.
        By default, NAs are skipped. If ``skipna=False`` is specified and
        missing values are present, similar :ref:`Kleene logic <boolean.kleene>`
        is used as for logical operations.

        Parameters
        ----------
        skipna : bool, default True