I am running a back test, but it comes up error:

Runtime Error: ValueError : Input contains NaN, infinity or a value too large for dtype('float32').
  at _assert_all_finite
    msg_dtype if msg_dtype is not None else X.dtype)
  File "validation.py" in validation.py: line 98

Here is the code:

           self.stochastic.Update(bar)
           prev_stochastic.append(float(self.stochastic.ToString()))
           
           self.rsi.Update(tup.Index, tup.close)
           prev_rsi.append(float(self.rsi.ToString()))

How can I fix it? Thanks