You can convert the NumPy array from float to int with the following code. If you want to learn Python, I highly recommend reading This Book.
# Import the NumPy library import numpy as np # Initialize the array a = np.array([5.2, 3.1, 12.7, 20.9]) # Convert the float to integer b = a.astype(int) # Display the conversion print(b)
Output:
[ 5 3 12 20]