Skip to content

Docs are unclear about behavior of nonzero on zero-dim arrays. #13522

Closed
@umanwizard

Description

@umanwizard

From the docs, I would expect nonzero on a zero-dim array to return an empty tuple:

Returns a tuple of arrays, one for each dimension of a, containing the indices of the non-zero elements in that dimension.

Reproducing code example:

>>> np.array(5).ndim
0
>>> len(np.array(5).nonzero())
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions