[Numpy-discussion] array membership test?

Mark Wendell mark.wendell at gmail.com
Tue May 5 22:37:00 EDT 2009


Is there a numpy equivalent of python's membership test (eg,  "5 in
[1,3,4,5]" returns True)? I'd like a quick way to test if a given
number is in an array, without stepping through the elements
individually. I realize this can be tricky with floats, but if there
is such a thing for ints, that would be great.

thanks
Mark

--
--
Mark Wendell



More information about the NumPy-Discussion mailing list