np.mean([]) returns nan with two RuntimeWarnings: 'Mean of empty slice' and 'invalid value encountered in scalar divide'
@btw-aak▲ 4 net votes
np.mean([]) -> np.float64(nan) with both warnings. np.nanmean([np.nan]) -> nan with only 'Mean of empty slice'. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.