title: n-dimensional sliding window with Pandas or Numpy
body: <p>How do I do the R(xts) equivalent of rollapply(...., by.column=FALSE), using Numpy or Pandas? When given a dataframe, pandas rolling_apply seems only to work column by column instead of providing the option to provide a full (window-size) x (data-frame-width) matrix to the target function.  </p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  xx = pd.DataFrame(np.zeros([10, 10]))
  pd.rolling_apply(xx, 5, lambda x: np.shape(x)[0]) 
  
      0   1   2   3   4   5   6   7   8   9
  0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  2 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  3 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  4   5   5   5   5   5   5   5   5   5   5
  5   5   5   5   5   5   5   5   5   5   5
  6   5   5   5   5   5   5   5   5   5   5
  7   5   5   5   5   5   5   5   5   5   5
  8   5   5   5   5   5   5   5   5   5   5
  9   5   5   5   5   5   5   5   5   5   5
  </code></pre>
  
  <p>So what's happening is rolling_apply is going down each column in turn and applying a sliding  5-length window down each one of these, whereas what I want is for the sliding windows to be a 5x10 array each time, and in this case, I would get a single column vector (not 2d array) result. </p>