[Numpy-discussion] Should array_equal work with non-numeric types?

Christopher Barker Chris.Barker@noaa....
Fri Mar 2 15:10:53 CST 2007


Hi all,

Should array_equal work with non-numeric types?

 >>> a
array(['a', 'b', 'c', 'd', 'e', 'f', 'g'],
       dtype='|S1')
 >>> b = a.copy()
 >>> a == b
array([True, True, True, True, True, True, True], dtype=bool)
 >>> numpy.array_equal(a,b)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/numeric.py", 
line 652, in array_equal
     return logical_and.reduce(equal(a1,a2).ravel())
AttributeError: 'NotImplementedType' object has no attribute 'ravel'


I can use:
 >>> numpy.all(a==b)
True

But I was wondering if array_equal should work.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the Numpy-discussion mailing list