Source code for tensortrade.feed.api.generic.imputation
"""imputation.py contains classes for imputation stream operations."""importnumpyasnpfromtensortrade.feed.core.baseimportStream,T
[docs]classForwardFill(Stream[T]):"""A stream operator that computes the forward fill imputation of a stream."""generic_name="ffill"def__init__(self)->None:super().__init__()self.previous=None
[docs]classFillNa(Stream[T]):"""A stream operator that computes the padded imputation of a stream. Parameters ---------- fill_value : `T` The fill value to use for missing values in the stream. """generic_name="fillna"def__init__(self,fill_value:T):super().__init__()self.fill_value=fill_value