![](https://secure.gravatar.com/avatar/5c708d3d225e9b906a4f059d134ee880.jpg?s=120&d=mm&r=g)
12 Jun
2021
12 Jun
'21
9:03 p.m.
Hi All, Is there a C-API analogue for `np.asarray(a, dtype=int) != np.asarray(a)` assuming that `a` is an array or python sequence object of whole numbers but is assigned the float type (e.g a=array([1., 2., 3.]) or [1., 2., 3.])? I tried `np.PyArray_FROM_OT(a, np.NPY_LONG) != np.PyArray_FROM_O(a)` but I get the error message: `TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'`. Is there a way I can achieve what I want using the numpy array c-api? I want to check if an array/sequence has all elements as whole numbers so that the check wont fail is an element is "2.0" instead of "2". -- Sent from: http://numpy-discussion.10968.n7.nabble.com/