8000 numpy.maximum since 1.15 raises RuntimeWarning when encountering a NaN even though the docs say it should propagate NaNs · Issue #12038 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
numpy.maximum since 1.15 raises RuntimeWarning when encountering a NaN even though the docs say it should propagate NaNs #12038
@tudorprodan

Description

@tudorprodan

numpy.maximum now raises a RuntimeWarning when encountering a NaN, but the documentation says it propagates NaNs and even goes to the trouble of saying exactly how they are propagated, which makes it seem like it shouldn't give a warning.

Reproducing code example:

In [1]: import numpy as np

In [2]: x = np.array([1, 2, np.nan], dtype=float)

In [3]: np.maximum(x, x)
/home/tudor/anaconda3/bin/ipython:1: RuntimeWarning: invalid value encountered in maximum
  #!/home/tudor/anaconda3/bin/python
Out[3]: array([ 1.,  2., nan])

Numpy/Python version information:

In [6]: import sys, numpy; print(numpy.__version__, sys.version)
1.15.1 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0