Editorial question118.3K views2,433 votes0 answers4,128 following
AI-generatedAll-NaN slices in np.nanmean: limits of the RuntimeWarning policy and distinguishing 'no data' from a NaN result
I am designing a data pipeline on NumPy (assume a recent 1.2x/2.x release) that reduces float arrays with np.nanmean and np.nansum along an axis. Some slices may be entirely NaN, and I need downstream code to treat "no valid observations" differently from "valid data whose mean happens to be NaN". The documented behavior is that NaN-aware reductions skip NaN