title: numpy array of 2 dimensions indexing and sum
body: <p>i have a doubt. There is an efficient way to sum all neighbors of a numpy matrix without using several conditions?</p>
  <p>This is an example:</p>
  <pre><code>array([[5, 4, 8, 3, 1, 4, 3, 2, 2, 3],
         [2, 7, 4, 5, 8, 5, 4, 7, 1, 1],
         [5, 2, 6, 4, 5, 5, 6, 1, 7, 3],
         [6, 1, 4, 1, 3, 3, 6, 1, 4, 6],
         [6, 3, 5, 7, 3, 8, 5, 4, 7, 8],
         [4, 1, 6, 7, 5, 2, 4, 6, 4, 5],
         [2, 1, 7, 6, 8, 4, 1, 7, 2, 1],
         [6, 8, 8, 2, 8, 8, 1, 1, 3, 4],
         [4, 8, 4, 6, 8, 4, 8, 5, 5, 4],
         [5, 2, 8, 3, 7, 5, 1, 5, 2, 6]])
  </code></pre>
  <p>When I run <code>m[0][-1]</code> it returns me 3 and not an error, so if I want to add 1 to all neighbors of a value I need to use a lot of conditions because I can't just use <code>m[0][-1]</code> because in this case and in the other cases of the corners it returns me just a &quot; False neighbor&quot;</p>