title: Getting the row index for a 2D numPy array when multiple column values are known
body: <p>Suppose I have a 2D numPy array such as: </p>
  
  <blockquote>
    <p>a = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]</p>
  </blockquote>
  
  <p>How to I find the index of the row for which I know multiple values? For example, if it is known that the 0th column is 2 and the 1st column is 5, I would like to know the row index where this condition is met (row 1 in this case).</p>
  
  <p>In my application, the first two columns are (x,y) coordinates, and the third column is information about that coordinate. I am trying to find particular coordinates in a list so I can change the value in the third column.</p>
  
  <p><em>EDIT: To clarify, here is a non-square example:</em></p>
  
  <blockquote>
    <p>a = [ [1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18] ]</p>
  </blockquote>
  
  <p>Suppose I know the row I am looking for has 13 in the 0th column, and 14 in the 1st column. I would like to return the index of that row. In this case, I would like to return the index 2 (2nd row).</p>
  
  <p>Or better yet, I would like to edit the 4th column of the row that has 13 in the 0th column and 14 in the 1st column. Here is a solution I found to the case I have described (changing the value to 999):</p>
  
  <blockquote>
    <p>a[(a[<strong>:,0</strong>]==13) &amp; (a[<strong>:,1</strong>]==14),
    3] = 999</p>
  </blockquote>
  
  <p>gives:</p>
  
  <blockquote>
    <p>a = [ [1, 2, 3, 4, 5, 6], [7, 8, 9,
    10, 11, 12], [13, 14, 15, 999, 17, 18] ]</p>
  </blockquote>
  
  <p>I'm sorry if this was unclear. Could someone point out in my original post (above the edit) how this could be interpreted differently, because I am having trouble seeing it.</p>
  
  <p>Thanks.</p>
  
  <p><em>EDIT 2: Fixed mistake in first edit (shown in bold)</em></p>
  
  <p>I can now see how I made this whole thing confusing for everyone. The solution to my problem is well described in condition b) of eat's solution. Thank you.</p>