class_docstr: This class replaces each missing value with the last value that was not
  missing.
  
  (If the first values are missing, they are replaced by the closest non
  missing value.)
class_docstr_tok: ["This","class","replaces","each","missing","value","with","the","last","value","that","was","not","missing",".","(","If","the","first","values","are","missing",",","they","are","replaced","by","the","closest","non","missing","value",".",")"]
code: def __call__(self, values: np.ndarray) -> np.ndarray:
      if len(values) == 1 or np.isnan(values).all():
          return DummyValueImputation()(values)
      values = np.expand_dims(values, axis=0)
  
      mask = np.isnan(values)
      idx = np.where(~mask, np.arange(mask.shape[1]), 0)
      np.maximum.accumulate(idx, axis=1, out=idx)
      out = values[np.arange(idx.shape[0])[:, None], idx]
  
      values = np.squeeze(out)
      # in case we need to replace nan at the start of the array
      mask = np.isnan(values)
      values[mask] = np.interp(
          np.flatnonzero(mask), np.flatnonzero(~mask), values[~mask]
      )
  
      return values
  
imports: from typing import List, Optional, Union, Type
  import numpy
  import pandas
  from gluonts.core.component import validated
  from gluonts.dataset.common import DataEntry
  from gluonts.dataset.field_names import FieldName
  from gluonts.time_feature import TimeFeature
  from ._base import MapTransformation, SimpleTransformation
label_desc: Use image node_id 1 for calling the LastValueImputation obj's underlying member method code with example usage: obj.__call__(values) and returns: values, DummyValueImputation