A Thursday 27 May 2010 05:52:22 Vincent Davis escrigué:
> How do I determine if an array's (or column in a structured array) dtype isI suppose that the `.kind` attribute of dtype would help you:
> a number or a string. I see how to determine the actual dtype but all I
> want to know is if it is a string or a number.
In : s = np.dtype("S3")
In : s.kind
In : i = np.dtype("i4")
In : i.kind
In : f = np.dtype("f8")
In : f.kind
I know about this but the problem is that while the fist example is usable, the others are not great because to know that it is a number I would need to do something like(see below) but I might miss a number dtype,
if obj.dtype.kind in ('i', 'f',..):
Pierre GM "Check `numpy.lib._iotools._is_string_like`"
This is ok, but I am having problem making it work, I keep getting an error that I am giving it 2 items and it only takes 1. Obviously I think I am giving it 1. This of course tells me if it is string like but not that "is" a number.