array float32 to int numpy code example
Example 1: np convert to int
>>> x = np.array([[1.0, 2.3], [1.3, 2.9]])
>>> x
array([[ 1. , 2.3],
[ 1.3, 2.9]])
>>> x.astype(int)
array([[1, 2],
[1, 2]])
Example 2: np float to int
int_array = float_array.astype(int)
Example 3: np as type
>>> x.astype(int)
array([1, 2, 2])