title: IndexError: index 9 is out of bounds for axis 0 with size 9
body: <p>I am using python-3.x, and I have searched about the following error but could not find the correct solution. The error occurred in the below code.</p>
  
  <p>I have a random numpy binary array and a random numbers array so the code will delete a binary row based on the value of the other array as you can see from the code.</p>
  
  <pre><code>import random
  import numpy as np
  np.set_printoptions(threshold=np.nan)
  
  
  for i in range (100):
  
  
      binary= np.random.randint (2, size=(10, 4))
      print("binary:" '\n',binary)
  
  
      value = np.random.randint (200, size=(10, 1))
      print("value:" '\n',value)
  
  
  
  
      for i in range (2):
  #       the loseer how have the of the binarys who has the smaslets value 
          loser = np.argmin(value)
  #        print ("loser:",loser)
  #        print("loser:", loser,(value[loser]))
  #        print (binary[loser,])
  #        print("Loser=", "Index:", loser,"value:",(value[loser]), "binary:",(binary[loser,]))
          print("Index:", loser)
          print("value:",(value[loser]))
          print("binary:",(binary[loser,]))
          print("Loser=", "Index:", loser,"value:",(value[loser]), "binary:",(binary[loser,]))
  
  
  
          binary = np.delete(binary, (loser), axis=0)
          print("binary:" '\n',binary)
  </code></pre>
  
  <p>the Error is: IndexError: index 9 is out of bounds for axis 0 with size 9'    </p>
  
  <p><strong>So in my code, where is the problem and how can solve it</strong>
  <strong>Any help would be highly appreciated</strong> </p>