To see if it is a number could you use something like:

np.issubdtype(a.dtype, float) or np.issubdtype(a.dtype, int) or

np.issubdtype(a.dtype, complex)

And for string:

np.issubdtype(a.dtype, str)

These are valid but what I don't like is that I need to know the list of possible number types. Basically I don't like a test that fails because I didn't know about a dtype. For string It is ok, the universe of is either string or not string. Maybe this is as good as it gets.

I guess my use case is that I want to be sure I can perform math on the values. So maybe I should just do someting like "numpy.lib._iotools._is_string_like" but "_is_number_like", Maybe there is such and I missed it. If not there should be.

Vincent

_______________________________________________

NumPy-Discussion mailing list

NumPy-Discussion@scipy.org

http://mail.scipy.org/mailman/listinfo/numpy-discussion

vincent@vincentdavis.net | ||