def get_median(x): mask = notna(x) if not skipna and not mask.all(): return np.nan return algos.median(_values_from_object(x[mask]))