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

Skip to content

array_equal fails on string dtypes #3015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
njsmith opened this issue Feb 25, 2013 · 2 comments · Fixed by #3322
Closed

array_equal fails on string dtypes #3015

njsmith opened this issue Feb 25, 2013 · 2 comments · Fixed by #3322

Comments

@njsmith
Copy link
Member

njsmith commented Feb 25, 2013

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

@njsmith
Copy link
Member Author

njsmith commented Feb 25, 2013

(confirmed with 1.8.0.dev-17774a6)

@charris
Copy link
Member

charris commented May 13, 2013

Closed by #3322.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants