title: IndexError: index out of bound
body: <p>I have read multiple questions asking about the error: </p>
  
  <p><code>IndexError: index 101 is out of bounds for axis 0 with size 11.</code>I receive this error already on the first iteration.</p>
  
  <pre><code>IndexError                                Traceback (most recent call last)
  &lt;ipython-input-62-9ee6ac0ee12b&gt; in &lt;module&gt;()
  
  --&gt;      x[i+1] = Chosen_Columns_best_result
  </code></pre>
  
  <p>The problem is that I still don't seem to get what the problem is.</p>
  
  <p>I got the following script:</p>
  
  <pre><code>import numpy as np
  Init_Sepquence = [122, 172, 123, 175, 227, 177, 152, 129, 89, 87, 127, 150, 174, 147, 148, 201, 171, 222, 241, 203, 205, 206, 176, 125, 173, 226, 245, 230, 229, 180, 182, 134, 110, 92, 56, 58, 93, 135, 161, 212, 183, 133, 132, 156, 209, 157, 159, 109, 91, 112, 114, 95, 57, 59, 44, 60, 79, 119, 120, 118, 117, 163, 115, 96, 137, 186, 138, 97, 98, 80, 46, 78, 61, 81, 82, 63, 64, 84, 48, 32, 45, 33, 31, 47, 22, 50, 34, 23, 21, 49, 35, 65, 51, 39, 25, 38, 52, 37, 36, 68, 69, 85, 53, 29, 12, 11, 27, 9, 5, 7, 3, 13, 20, 4, 2, 6, 19, 28, 41, 54, 40, 18, 26, 24, 8, 16, 15, 14, 260, 238, 240, 254, 224, 252, 242, 261, 253, 225, 244, 255, 262, 243, 228, 207, 179, 128, 103, 124, 126, 153, 151, 149, 202, 204, 178, 130, 108, 154, 104, 106, 155, 208, 181, 210, 184, 213, 158, 131, 90, 72, 70, 107, 71, 55, 73, 113, 162, 160, 185, 187, 139, 116, 141, 101, 62, 99, 140, 100, 83, 66, 102, 67, 211, 250, 258, 266, 251, 223, 200, 198, 220, 168, 142, 144, 196, 234, 195, 167, 165, 216, 233, 246, 236, 235, 197, 146, 199, 145, 143, 170, 169, 221, 219, 217, 248, 249, 239, 259, 237, 256, 264, 257, 247, 263, 265, 111, 136, 94, 74, 75, 43, 76, 77, 42, 30, 231, 191, 193, 166, 192, 164, 190, 214, 189, 188, 86, 105, 88, 121, 10, 17, 194, 215, 232, 1, 218]
  TotalNumbcol = 266
  x = np.zeros((n+1,len(Init_Sequence)))                           # x = list with all best solutions
  x[0] = Init_Sequence
  
  n = 10
  m = 10
  
  for i in range(n):
      print i
      print 'Cycle:' + str(i)
      for j in range(m):
          # Creating a new random sequence
          Column_Numbers2 = list(np.arange(1,TotalNumbcol+1,1))
          Chosen_Columns2 = []
          shuffle(Column_Numbers2)
          rand = Column_Numbers2.pop()
          Chosen_Columns2.append(rand)
          while Column_Numbers2:
              for i in range(rand-1,rand):
                  rand = NeighborsperColumn[i]
                  rand = [y for y in rand if y not in Chosen_Columns2]
                  shuffle(rand)
                  try:
                      rand = rand.pop()
                      Chosen_Columns2.append(rand)
                      Column_Numbers2.remove(rand)
                  except IndexError:
                      rand = Column_Numbers2.pop()
                      Chosen_Columns2.append(rand)
          Chosen_Columns_best_result = Chosen_Columns2 # In my complete script not every Chosen_Columns2 result is a 
                                                       #Chosen_Columns_best_result, but its to make this script a bit faster to read
      x[i+1] = Chosen_Columns_best_result # Here I try to change the i with zeros into Chosen_Columns_best_result, but it fails
  </code></pre>
  
  <p>I don't see why my Chosen_Columns_best_result which has a length of 266 cannot fit in the x[i+1] when x is defined as:</p>
  
  <pre><code>x = np.zeros((n+1,len(Init_Sequence)))
  </code></pre>
  
  <p>Hope anyone can explain to me (very much a beginner) how to resolve this issue.</p>