
May 27, 2010
7:27 a.m.
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 is 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.
I suppose that the `.kind` attribute of dtype would help you: In [2]: s = np.dtype("S3") In [4]: s.kind Out[4]: 'S' In [5]: i = np.dtype("i4") In [6]: i.kind Out[6]: 'i' In [7]: f = np.dtype("f8") In [8]: f.kind Out[8]: 'f' -- Francesc Alted