8000 BUG: ufunc.reduce(ndarray(dtype=object)) returns bool · Issue #8860 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: ufunc.reduce(ndarray(dtype=object)) returns bool #8860

@eric-wieser

Description

@eric-wieser

This is pretty weird:

>>> arr = np.array([1, 2, 3], dtype=object)
>>> np.add.reduce(arr)
6
>>> np.add.reduce(arr[:0])
False
>>> np.multiply.reduce(arr)
6
>>> np.multiply.reduce(arr[:0])
True

It happens for array results too:

>>> arr = np.array([[1], [2], [3]], dtype=object)
>>> np.add.reduce(arr[:0], axis=0)
array([False], dtype=object)
>>> np.multiply.reduce(arr[:0], axis=0)
array([True], dtype=object) 

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