title: Python enumerate through 2D array in numpy
body: <p>I want a function that behaves like <code>enumerate</code>, but on numpy arrays.</p>
  
  <pre><code>&gt;&gt;&gt; list(enumerate("hello"))
  [(0, "h"), (1, "e"), (2, "l"), (3, "l"), (4, "o")]
  
  &gt;&gt;&gt; for x, y, element in enumerate2(numpy.array([[i for i in "egg"] for j in range(3)])):
          print(x, y, element)
  
  0 0 e
  1 0 g
  2 0 g
  0 1 e
  1 1 g
  2 1 g
  0 2 e
  1 2 g
  2 2 g
  </code></pre>
  
  <p>Currently I am using this function:</p>
  
  <pre><code>def enumerate2(np_array):
      for y, row in enumerate(np_array):
          for x, element in enumerate(row):
              yield (x, y, element)
  </code></pre>
  
  <p>Is there any better way to do this? E.g. an inbuilt function (I couldn't find any), or a different definition that is faster in some way.</p>