Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

nanmean and nanvar raise odd RuntimeWarning #15219

Copy link
Copy link
Open
@admercs

Description

@admercs
Issue body actions

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

No one assigned

    Labels

    15 - Discussion62 - Python APIChanges 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.