["python","numpy"]
Convert 2D float array to 2D int array in NumPy

How do I convert a float NumPy array into an int NumPy array?
Use the astype method. >>> 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]])