title: ValueError: values are all NaN?
body: <p>can anyone please tell where i am going wrong in the code, because values are all coming NaN which i dont want. I want to have a series of average high of 25 previous RSIndex values( you can consider it as lookback period) for each RSIndex value.</p>
  <pre><code>def AvgHigh(ser, src, cnt, val) :
      total = 0.0
      count = 0
      for i in (0, ser) :
          for a in range(i, i+cnt) :
              if src[a] &gt; val :
                  count = count + 1
                  total = total + src[a]
              elif src[a] &lt;= val :
                  count = count + 0
                  total = total + 0
          return round(total / count)
  
  df['RSI_high'] = pd.Series(AvgHigh(len(df['RSIndex']), df['RSIndex'], 25, 52)).fillna(0)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/432qj.png" rel="nofollow noreferrer">dataframe image</a></p>