title: Python: extract the core of a 2D numpy array
body: <p>Say I have a 2D numpy array like this:</p>
  
  <pre><code>In[1]: x
  Out[1]:
  array([[0, 0, 0, 0, 0],
         [1, 1, 1, 1, 1],
         [2, 2, 2, 2, 2],
         [3, 3, 3, 3, 3],
         [4, 4, 4, 4, 4],
         [5, 5, 5, 5, 5]], dtype=int64)
  </code></pre>
  
  <p>and I want to extract the <code>(n-1)*(m-1)</code> core, which would be:</p>
  
  <pre><code>array([[1, 1, 1],
         [2, 2, 2],
         [3, 3, 3],
         [4, 4, 4]], dtype=int64)
  </code></pre>
  
  <p>How could I do this, since the data structure is not <em>flat</em>? Do you suggest flattening it first? </p>
  
  <p>This is a simplified version of a much bigger array, which core has dimension <code>(n-33)*(n-33)</code>.</p>