On Thu, May 27, 2010 at 11:40, Vincent Davis firstname.lastname@example.org wrote:
On Thu, May 27, 2010 at 8:39 AM, Keith Goodman email@example.com wrote:
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:
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.
The dtypes have a hierarchy.
In : np.issubdtype(float, np.number) Out: True
In : np.issubdtype(str, np.number) Out: False
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco