Skip to content

BUG: nanops._has_infs doesn't work with many dtypes #7357

Closed
@toddrjen

Description

@toddrjen

nanops._has_infs, which is used in determining whether to employ bottleneck optimizations, fails on dtypes which should otherwise be supported, including 'f2', complex, and multidimensional 'f4' and 'f8'.

>>> from pandas.core import nanops
>>> import numpy as np
>>> 
>>> val0 = np.ones(10)*np.inf
>>> val1 = val0.astype('f2')
>>> val2 = val0+val0*1j
>>> val3 = np.tile(val0, (1, 10))
>>> 
>>> nanops._has_infs(val0)
True
>>> nanops._has_infs(val1)
False
>>> nanops._has_infs(val2)
False
>>> nanops._has_infs(val3)
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsInternalsRelated to non-user accessible pandas implementationNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions