class_docstr: Applies a difference transform to the input time series. We include it
  as a moving average because we can consider the difference transform
  to be a 2-step moving "average" with weights w = [-1, 1].
class_docstr_tok: ["Applies","a","difference","transform","to","the","input","time","series",".","We","include","it","as","a","moving","average","because","we","can","consider","the","difference","transform","to","be","a","2-step","moving","``","average","''","with","weights","w","=","[","-1",",","1","]","."]
code: def __call__(self, time_series: TimeSeries) -> TimeSeries:
      x0 = {}
      new_vars = OrderedDict()
      for name, var in time_series.items():
          x0[name] = var[0]
          if len(var) <= 1:
              logger.warning(
                  f"Cannot apply a difference transform to a time series of length {len(var)} < 2"
              )
              new_vars[name] = UnivariateTimeSeries([], [])
          else:
              new_vars[name] = UnivariateTimeSeries.from_pd(var.diff())[
                  1:
              ]
  
      self.inversion_state = x0
      ret = TimeSeries(new_vars, check_aligned=False)
      ret._is_aligned = time_series.is_aligned
      return ret
  
imports: from collections import OrderedDict
  import logging
  from typing import Sequence
  import numpy
  import scipy.signal
  from scipy.stats import norm
  from merlion.transform.base import TransformBase, InvertibleTransformBase
  from merlion.utils import UnivariateTimeSeries, TimeSeries
label_desc: Use image node_id 2 for calling the DifferenceTransform obj's underlying member method code with example usage: obj.__call__(time_series) and returns: ret