Python | Numpy np.coords() method
Last Updated :
03 Nov, 2019
With the help of np.coords()
method, we can get the coordinates of a next value in iteration using np.coords()
method.
Syntax : np.coords()
Return : Return the coordinates of next iterator.
Example #1 :
In this example we can see that by using np.coords()
method, we are able to get the coordinates of a next iterator using this method.
import numpy as np
a = np.array([ 1 , 2 , 3 ])
gfg = a.flat
next (gfg)
print (gfg.coords)
|
Output :
(1, )
Example #2 :
import numpy as np
a = np.array([[ 1 , 2 , 3 ], [ 4 , 5 , 6 ]])
gfg = a.flat
next (gfg)
next (gfg)
next (gfg)
next (gfg)
print (gfg.coords)
|
Output :
(1, 1)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...