Skip to content

API/BUG: np.dtype equality comparisons versus string-like is inconsistent #5329

@jreback

Description

@jreback

xref: pandas-dev/pandas#8814

using numpy 1.9.1/macosx

np.dtype equality checking versus string-likes should return a boolean rather than raising
in dtype comparisons. This is currently inconsistent when presented with a valid dtype parse of the string, but will raise if its not valid.

e.g

In [12]: np.dtype('i8') == 'int64'
Out[12]: True

In [14]: np.dtype('i8') == 'int32'
Out[14]: False

In [13]: np.dtype('i8') == 'foo'
TypeError: data type "foo" not understood

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