[Numpy-discussion] how to check type of array?
Derek Homeier
derek at astro.physik.uni-goettingen.de
Thu Mar 29 08:56:50 EDT 2012
On 29 Mar 2012, at 14:49, Robert Kern wrote:
>> all work. For a more general check (e.g. if it is any type of integer), you can do
>>
>> np.issubclass_(a.dtype.type, np.integer)
>
> I don't recommend using that. Use np.issubdtype(a.dtype, np.integer) instead.
Sorry, you're right, this works the same way - I had the impression from the documentation
that tests like np.issubdtype(np.int16, np.integer) would not work, but they do.
Cheers,
Derek
More information about the NumPy-Discussion
mailing list