Numpy matrix.astype () method we can convert the matrix type, but the problem is data loss, if we want to convert float to int then some data will be lost. This method helps in transformation of the matrix type.
Return: Return the matrix after type conversion.
Example # 1:
In this example, we see how we convert a floating matrix to an int matrix using
matrix.astype () .
[[1 2 3 4]]
Example # 2:
[[1 2 3] [4 5 6] [7 8 9]]