Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bincount fails for complex weights #16903

Open
@feature-engineer

Description

@feature-engineer

bincount would only work for real weights, and not complex ones.

Reproducing code example:

import numpy as np
np.bincount(np.arange(3), weights=1j * np.arange(3))

Error message:

Traceback (most recent call last):
File "", line 1, in
File "<array_function internals>", line 6, in bincount
TypeError: Cannot cast array data from dtype('complex128') to dtype('float64') according to rule 'safe'

Numpy/Python version information:

1.18.4 3.7.7

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