Skip to content

ufunc.reduce hides warnings #8954

@eric-wieser

Description

@eric-wieser

Arguments that would cause ufunc.__call__ to throw a warning seem to not do so when passed to ufunc.reduce:

Bug or feature?

In [24]: np.minimum(*[1, np.nan])
RuntimeWarning: invalid value encountered in minimum
Out[24]: nan

In [25]: np.minimum.reduce([1, np.nan])
Out[25]: nan

# not just minimum
In [28]: np.divide(*[1, 0])
RuntimeWarning: divide by zero encountered in true_divide
Out[28]: inf

In [29]: np.divide.reduce([1, 0])
Out[29]: inf

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