Python | Numpy matrix.getfield()
Last Updated :
15 Apr, 2019
With the help of Numpy matrix.getfield()
method, we can get the field matrix that means field is a view of the matrix with a given data-type of the same size as of our given matrix.
Syntax : matrix.getfield()
Return : Return field matrix
Example #1 :
In this example we can see that we are able to get the field matrix with the help of method matrix.getfield()
.
import numpy as np
gfg = np.matrix( '[6, 1; 2, 3]' )
geeks = gfg.getfield( int )
print (geeks)
|
Example #2 :
import numpy as np
gfg = np.matrix( '[1, 2, 3; 4, 5, 6; 7, 8, 9]' )
geeks = gfg.getfield( int )
print (geeks)
|
Output:
[[1 2 3]
[4 5 6]
[7 8 9]]
Share your thoughts in the comments
Please Login to comment...