Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Francesc Alted
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

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Vincent Davis
On Thu, May 27, 2010 at 1:27 AM, Francesc Alted fal...@pytables.org wrote: 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

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Keith Goodman
On Thu, May 27, 2010 at 6:02 AM, Vincent Davis vinc...@vincentdavis.net wrote: On Thu, May 27, 2010 at 1:27 AM, Francesc Alted fal...@pytables.org wrote: 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

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Vincent Davis
On Thu, May 27, 2010 at 8:39 AM, Keith Goodman kwgood...@gmail.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: np.issubdtype(a.dtype, str) These are valid

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Robert Kern
On Thu, May 27, 2010 at 11:40, Vincent Davis vinc...@vincentdavis.net wrote: On Thu, May 27, 2010 at 8:39 AM, Keith Goodman kwgood...@gmail.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,

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Bruce Southey
On 05/27/2010 10:40 AM, Vincent Davis wrote: On Thu, May 27, 2010 at 8:39 AM, Keith Goodman kwgood...@gmail.com mailto:kwgood...@gmail.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

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Vincent Davis
On Thu, May 27, 2010 at 10:25 AM, Bruce Southey bsout...@gmail.com wrote: On 05/27/2010 10:40 AM, Vincent Davis wrote: Can you give an example of what you are trying to do? arr = np.array([(1,'a'),(2,'b')], dtype =[(num,int),(str, |s2)] No supposed I want to know if I can sum the values in

[Numpy-discussion] How to distinguish between number and string dypes

2010-05-26 Thread Vincent Davis
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. *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog http://vincentdavis.net |