8000 BUG: nanstd/nanvar gives spurious ComplexWarning when input is real but dtype is complex · Issue #8000 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: nanstd/nanvar gives spurious ComplexWarning when input is real but dtype is complex #8000

@seberg

Description

@seberg

When the input array is a real array, but the dtype argument is given to be complex, the nanstd and nanvar functions will give a ComplexWarning, even though the complex part is always zero. This is due to the line:

np.subtract(arr, avg, out=arr, casting='unsafe')

where arr is the original type, but avg the new (complex) type, which gives the warning.

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

      0