Skip to content

array_equal fails on string dtypes #3015

Closed

Description

@njsmith

If I pass two ndarrays with string dtype to array_equal, it blows up:

In [151]: a = np.asarray(["a", "b"])

In [152]: a
Out[152]: 
array(['a', 'b'], 
      dtype='|S1')

In [153]: np.array_equal(a, a)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-153-8f762db9db16> in <module>()
----> 1 np.array_equal(a, a)

/home/njs/.user-python2.7-64bit/lib/python2.7/site-packages/numpy/core/numeric.pyc in array_equal(a1, a2)
   1975     if a1.shape != a2.shape:
   1976         return False
-> 1977     return bool(logical_and.reduce(equal(a1,a2).ravel()))
   1978 
   1979 def array_equiv(a1, a2):

AttributeError: 'NotImplementedType' object has no attribute 'ravel'

Expected result: True

Activity

  1. njsmith commented on Feb 25, 2013

    @njsmith
    MemberAuthor

    (confirmed with 1.8.0.dev-17774a6)

  2. charris commented on May 13, 2013

    @charris
    Member

    Closed by #3322.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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