Open
Description
nanmean
and nanvar
raise RuntimeWarning
exceptions that are not called by their non-nan counterpart functions.
Reproducing code example:
import numpy as np
test = np.zeros((2, 3, 4))
test[:,:,1:2] = np.nan
np.mean(test, axis=0) # OK
np.nanmean(test, axis=0) # RuntimeWarning: Mean of empty slice
np.var(test, axis=0) # OK
np.nanvar(test, axis=0) # RuntimeWarning: Degrees of freedom <= 0 for slice.
Error message:
RuntimeWarning: Mean of empty slice
RuntimeWarning: Degrees of freedom <= 0 for slice.
Numpy/Python version information:
1.17.2 3.7.4 (default, Aug 13 2019, 15:17:50) [Clang 4.0.1 (tags/RELEASE_401/final)]
Metadata
Metadata
Assignees
Labels
Changes or additions to the Python API. Mailing list should usually be notified.Changes or additions to the Python API. Mailing list should usually be notified.