title: numpy create array of the max of consecutive pairs in another array
body: <p>I have a numpy array:</p>
  <pre class="lang-py prettyprint-override"><code>A = np.array([8, 2, 33, 4, 3, 6])
  </code></pre>
  <p>What I want is to create another array B where each element is the pairwise max of 2 consecutive pairs in A, so I get:</p>
  <pre class="lang-py prettyprint-override"><code>B = np.array([8, 33, 33, 4, 6])
  </code></pre>
  <p>Any ideas on how to implement?<br>
  Any ideas on how to implement this for more then 2 elements? (same thing but for consecutive n elements)</p>
  <h2>Edit:</h2>
  <p>The answers gave me a way to solve this question, but for the n-size window case, is there a more efficient way that does not require loops?</p>
  <h2>Edit2:</h2>
  <p>Turns out that the question is equivalent for asking how to perform 1d max-pooling of a list with a window of size n.
  Does anyone know how to implement this efficiently?</p>