title: pandas rolling_apply TypeError: int object is not iterable"
body: <p>I have a function saved and defined in a different script called <em>TechAnalisys.py</em>  This function just outputs a scalar, so I plan to use pd.rolling_apply() to generate a new column into the original dataframe (<code>df</code>). 
  The function works fine when executed, but I have problems when using the <code>rolling_apply()</code> application.This link <a href="https://stackoverflow.com/questions/31799585/passing-arguments-to-rolling-apply">Passing arguments to rolling_apply</a> shows how you should do it, and that is how I think it my code is but it still shows the error "TypeError: int object is not iterable" appears</p>
  
  <p>This is the function (located in the script  TechAnalisys.py) </p>
  
  <pre><code>def hurst(df,days):
      import pandas as pd
      import numpy as np
  
      df2 = pd.DataFrame()
      df2 = df[-days:]    
      rango = lambda x: x.max() - x.min()
  
      df2['ret'] = 1 - df.PX_LAST/df.PX_LAST.shift(1)
      df2 = df2.dropna()    
      ave = pd.expanding_mean(df2.ret)
      df2['desvdeprom'] = df2.ret - ave
      df2['acum'] = df2['desvdeprom'].cumsum()
      df2['rangorolled'] = pd.expanding_apply(df2.acum, rango)
      df2['datastd']  =   pd.expanding_std(df2.ret)
      df2['rango_rangostd'] = np.log(df2.rangorolled/df2.datastd)
      df2['tiempo1'] = np.log(range(1,len(df2.index)+1))
      df2 = df2.dropna()
      model1 = pd.ols(y=df2['rango_rangostd'], x=df2['tiempo1'], intercept=False)
      return model1.beta
  </code></pre>
  
  <p>and now this is the main script:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import TechAnalysis as ta
  
  df  = pd.DataFrame(np.log(np.cumsum(np.random.randn(100000)+1)+1000),columns =['PX_LAST'])
  </code></pre>
  
  <p>The following works:</p>
  
  <pre><code>print ta.hurst(df,50)
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>df['hurst_roll'] = pd.rolling_apply(df, 15 , ta.hurst, args=(50))  
  </code></pre>
  
  <p>Whats wrong in the code?</p>