[Numpy-discussion] np.equal
Keith Goodman
kwgoodman at gmail.com
Sun Dec 6 12:27:25 EST 2009
On Sun, Dec 6, 2009 at 4:57 AM, <josef.pktd at gmail.com> wrote:
> what's the difference in the implementation between np.equal and == ?
> np.equal raises NotImplemented for strings, while == works.
>
>>>> aa
> array(['a', 'b', 'a', 'aa', 'a'],
> dtype='|S2')
>
>>>> aa == 'a'
> array([ True, False, True, False, True], dtype=bool)
>>>> np.equal(aa,'a')
> NotImplemented
>
>
>>>> np.equal(np.arange(5),1)
> array([False, True, False, False, False], dtype=bool)
>>>> np.equal(np.arange(5),'a')
> NotImplemented
>>>> np.arange(5) == 'a'
> False
Seems like none of the ufuncs can handle strings:
>> np.log('a')
NotImplemented
>> np.exp('a')
NotImplemented
>> np.add('a', 'b')
NotImplemented
>> np.negative('a')
NotImplemented
>> np.sin('a')
NotImplemented
More information about the NumPy-Discussion
mailing list