title: How to use numba with pandas.Rolling.Apply
body: <p>I want to speed up my following code:</p>
  <pre><code>values_list = []
  indices_list = []
  
  offset_by_w = pd.tseries.frequencies.to_offset(135)
  
  _ = signal[::-1].rolling(offset_by_w, min_periods=4, closed='both')./
  apply(lambda x: [0, indices_list.append((x.index[-1], x.index[0])), values_list.append(x[::-1])][0], raw=True, engine='numba')
  </code></pre>
  <p>but I get an error:</p>
  <pre><code>numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
  Failed in nopython mode pipeline (step: nopython frontend)
  Failed in nopython mode pipeline (step: nopython frontend)
  Untyped global name 'indices_list': Cannot type empty list
  </code></pre>
  <p>How can I solve this problem with saving  <code>values_list </code>,  <code>indices_list </code>?</p>
  <p><code>signal</code> is <code>pd.Series</code> where indexies' type is <code>Timestamp</code> and values' type is <code>float</code></p>
  <p>I have <code>pd.Series</code> like this:</p>
  <p><a href="https://i.stack.imgur.com/06B7U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/06B7U.png" alt="example of input data" /></a></p>
  <p>And I want to roll with moving window through the data (by reverse order) to get two lists with <code>apply</code> method:</p>
  <ol>
  <li><a href="https://i.stack.imgur.com/VbeDi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VbeDi.png" alt="values_list" /></a></li>
  </ol>
  <p>where the 1st element looks like</p>
  <p><a href="https://i.stack.imgur.com/mMpqY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mMpqY.png" alt="1st element of values_list" /></a></p>
  <p>the 2nd element looks like</p>
  <p><a href="https://i.stack.imgur.com/yHzBr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yHzBr.png" alt="2nd element of values_list" /></a></p>
  <ol start="2">
  <li><a href="https://i.stack.imgur.com/vgUzG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vgUzG.png" alt="indices_list" /></a></li>
  </ol>
  <p>where the 1st element looks like</p>
  <p><a href="https://i.stack.imgur.com/bmOlN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmOlN.png" alt="1st element of indices_list" /></a></p>
  <p>the 2nd element looks like</p>
  <p><a href="https://i.stack.imgur.com/QcoJd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QcoJd.png" alt="2nd element of indices_list" /></a></p>