In this example we will show how to convert data type from float to integer by using int as parameter value in Python NumPy.
Source Code
import numpy as np
n = np.array([1.2, 3.4, 5.6, 7.8])
float_to_int = n.astype(int)
print(float_to_int)
print(float_to_int.dtype)
Output:
[1 3 5 7]
int32