[Numpy-discussion] simpliest way to check: array x is float, not integer

Stefan van der Walt stefan at sun.ac.za
Tue May 1 18:27:06 EDT 2007


On Tue, May 01, 2007 at 12:05:20PM -0000, Simon Berube wrote:
> Alternatively, as a hackjob type check you could also do an
> "isinstance" check on the first element of the array since, unlike
> lists, arrays have uniform elements all the way through.

Or use

N.issubdtype(x.dtype,int)  and  N.issubdtype(x.dtype,float)

Cheers
Stéfan



More information about the NumPy-Discussion mailing list