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/
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to