title: Numpy Error using 'np.arange': Index Error
body: <p>I am working with the code shown below and am getting an Index Error:</p>
  <blockquote>
  <p>index 8 is out of bounds for axis 1 with size 8  and</p>
  <p>index 6 is out of bounds for axis 0 with size 6`.</p>
  </blockquote>
  <p>When changing <code>np.arrange(1,9)</code> and <code>np.arrange(2,8)</code> to <code>np.arrange(8)</code> and <code>np.arrange(6)</code> respectively the code runs with no errors. However, the output matrix C is giving different results than expected. What if I want <code>i</code> and <code>j</code> to be an integer with values (1,2,3,4,5,6,7,8) instead of (0,1,2,3,4,5,6,7) and <code>k</code> and <code>l</code> with integer values (2,3,4,5,6,7)? I am creating a matrix C which looks at the inner 6x6 square of B (ignoring the border) and uses the matrix D as a 'weight' when determining the values of matrix C.</p>
  <pre><code>import numpy
  import numpy as np
  
  
  A = np.matrix([[8,8,8,7,7,6,8,2],
                 [8,8,7,7,7,6,6,7],
                 [1,8,8,7,7,6,6,6],
                 [1,1,8,7,7,6,7,7],
                 [1,1,1,1,8,7,7,6],
                 [1,1,2,1,8,7,7,6],
                 [2,2,2,1,1,8,7,7],
                 [2,1,2,1,1,8,8,7]])
  
  
  B = np.ones((8,8),dtype=np.int)
  
  for i in np.arange(1,9):
      for j in np.arange(1,9):
          B[i,j] = A[i,j]
  
  C = np.zeros((6,6),dtype=np.int)
  print C
  
  D = np.matrix([[1,1,2,3,3,2,2,1],
                 [1,2,1,2,3,3,3,2],
                 [1,1,2,1,1,2,2,3],
                 [2,2,3,2,2,2,1,3],
                 [1,2,2,3,2,3,1,3],
                 [1,2,3,3,2,3,2,3],
                 [1,2,2,3,2,3,1,2],
                 [2,2,3,2,2,3,2,2]])
  print D
  
  for k in np.arange(2,8):
      for l in np.arange(2,8):
  
  
              B[k,l] # point in middle
              b = B[(k-1),(l-1)]
              if b == 8:
                  # Matrix C is smaller than Matrix B
                  C[(k-1),(l-1)] = C[(k-1),(l-1)] + 1*D[(k-1),(l-1)]
  </code></pre>