On Mon, May 4, 2009 at 3:55 PM, David Warde-Farley email@example.com:
Is there a simple way to compare each element of an object array to a single object? objarray == None, for example, gives me a single "False". I couldn't find any reference to it in the documentation, but I'll admit, I wasn't quite sure where to look.
I think it might depend on some factors:
In : a = np.array(['a','b'], dtype=np.object)
In : a=='a' Out: array([ True, False], dtype=bool)
In : a==None Out: False
In : a ==  Out: False
In : a == '' Out: array([False, False], dtype=bool)
In : a == dict() Out: array([False, False], dtype=bool)
In : numpy.__version__ Out: '1.4.0.dev6885'
In : a == 5 Out: array([False, False], dtype=bool)
In : a == 5. Out: array([False, False], dtype=bool)
But based on these results, I have no idea what the factors might be. I know this works with datetime objects, but I'm really not sure why None and the empty list don't work.