class_docstr: A time series differencer.
  
  References
  ----------
  [^1]: [Stationarity and differencing](https://otexts.com/fpp2/stationarity.html)
  [^2]: [Backshift notation](https://otexts.com/fpp2/backshift.html)
class_docstr_tok: ["A","time","series","differencer",".","References","--","--","--","--","--","[","^1","]",":","[","Stationarity","and","differencing","]","(","https",":","\/\/otexts.com\/fpp2\/stationarity.html",")","[","^2","]",":","[","Backshift","notation","]","(","https",":","\/\/otexts.com\/fpp2\/backshift.html",")"]
docstr: Differentiate by applying each coefficient c at each index t.
  
  Parameters
  ----------
  Y
      The window of previous values. The first element is assumed to be the most recent
      value.
docstr_tok: ["Differentiate","by","applying","each","coefficient","c","at","each","index","t.","Parameters","--","--","--","--","--","Y","The","window","of","previous","values",".","The","first","element","is","assumed","to","be","the","most","recent","value","."]
code: def diff(self, p, Y: list):
      """Differentiate by applying each coefficient c at each index t.
  
      Parameters
      ----------
      Y
          The window of previous values. The first element is assumed to be the most recent
          value.
  
      """
      total = 0
      for t, c in self.coeffs.items():
          try:
              total += (c * Y[t - 1]) if t else p
          except IndexError:
              break
      return total
  
file_path: river/river/time_series/snarimax.py
imports: from __future__ import annotations
  import collections
  import itertools
  import math
  from river import base, linear_model, preprocessing, time_series
label_desc: Use image node_id 5 for calling the Differencer obj's underlying member method code with example usage: obj.diff(p, Y) and returns: total