@@ -726,7 +726,7 @@ def nanmean(
726
726
727
727
728
728
@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 :
730
730
"""
731
731
Parameters
732
732
----------
@@ -738,7 +738,7 @@ def nanmedian(values, *, axis: AxisInt | None = None, skipna: bool = True, mask=
738
738
739
739
Returns
740
740
-------
741
- result : float
741
+ result : float | ndarray
742
742
Unless input is a float array, in which case use the same
743
743
precision as the input array.
744
744
@@ -758,7 +758,7 @@ def nanmedian(values, *, axis: AxisInt | None = None, skipna: bool = True, mask=
758
758
# cases we never need to set NaN to the masked values
759
759
using_nan_sentinel = values .dtype .kind == "f" and mask is None
760
760
761
- def get_median (x , _mask = None ):
761
+ def get_median (x : np . ndarray , _mask = None ):
762
762
if _mask is None :
763
763
_mask = notna (x )
764
764
else :
@@ -794,6 +794,8 @@ def get_median(x, _mask=None):
794
794
795
795
notempty = values .size
796
796
797
+ res : float | np .ndarray
798
+
797
799
# an array from a frame
798
800
if values .ndim > 1 and axis is not None :
799
801
# there's a non-empty array to apply over otherwise numpy raises
0 commit comments