Python | Numpy np.coords() method (original) (raw)

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.

Python3 1=1 `

import numpy

import numpy as np

a = np.array([1, 2, 3])

using np.coords() method

gfg = a.flat next(gfg) print(gfg.coords)

`

Output :

(1, )

Example #2 :

Python3 1=1 `

import numpy

import numpy as np

a = np.array([[1, 2, 3], [4, 5, 6]])

using np.coords() method

gfg = a.flat next(gfg) next(gfg) next(gfg) next(gfg) print(gfg.coords)

`

Output :

(1, 1)