@@ -726,7 +726,7 @@ def nanmean(
726726
727727
728728@bottleneck_switch ()
729- def nanmedian (values , * , axis : AxisInt | None = None , skipna : bool = True , mask = None ):
729+ def nanmedian (values : np . ndarray , * , axis : AxisInt | None = None , skipna : bool = True , mask = None ) -> float | np . ndarray :
730730 """
731731 Parameters
732732 ----------
@@ -738,7 +738,7 @@ def nanmedian(values, *, axis: AxisInt | None = None, skipna: bool = True, mask=
738738
739739 Returns
740740 -------
741- result : float
741+ result : float | ndarray
742742 Unless input is a float array, in which case use the same
743743 precision as the input array.
744744
@@ -758,7 +758,7 @@ def nanmedian(values, *, axis: AxisInt | None = None, skipna: bool = True, mask=
758758 # cases we never need to set NaN to the masked values
759759 using_nan_sentinel = values .dtype .kind == "f" and mask is None
760760
761- def get_median (x , _mask = None ):
761+ def get_median (x : np . ndarray , _mask = None ):
762762 if _mask is None :
763763 _mask = notna (x )
764764 else :
@@ -794,6 +794,8 @@ def get_median(x, _mask=None):
794794
795795 notempty = values .size
796796
797+ res : float | np .ndarray
798+
797799 # an array from a frame
798800 if values .ndim > 1 and axis is not None :
799801 # there's a non-empty array to apply over otherwise numpy raises
0 commit comments