Re: [Numpy-discussion] Checking if all array elements are whole numbers using the C-API

2021-06-13 Thread zoj613
After reading the docs, it turns out that `np.PyArray_FROM_OTF(a, np.NPY_LONG, np.NPY_ARRAY_FORCECAST) != np.PyArray_FROM_O(a)` prevents the error from occurring. -- Sent from: http://numpy-discussion.10968.n7.nabble.com/ ___ NumPy-Discussion mailing

[Numpy-discussion] Checking if all array elements are whole numbers using the C-API

2021-06-12 Thread zoj613
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)