orion.primitives.timeseries_preprocessing.fillna

orion.primitives.timeseries_preprocessing.fillna(X, value=None, method=None, axis=None, limit=None, downcast=None)[source]

Impute missing values.

This function fills the missing values of the input sequence with the next/ previous known value. If there are contigous NaN values, they will all be filled with the same next/previous known value.

Parameters
  • X (ndarray or pandas.DataFrame) – Array of input sequence.

  • value – Optional. Value to use to fill holes (e.g. 0), alternately a dict/Series/DataFrame of values specifying which value to use for each index (for a Series) or column (for a DataFrame). Values not in the dict/Series/DataFrame will not be filled. This value cannot be a list. Default is None.

  • method (str or list) – Optional. String or list of strings describing whether to use forward or backward fill. pad / ffill: propagate last valid observation forward to next valid. backfill / bfill: use next valid observation to fill gap. Otherwise use None to fill with desired value. Possible values include [‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None]. Default is None.

  • axis (int or str) – Optional. Axis along which to fill missing value. Possible values include 0 or “index”, 1 or “columns”. Default is None.

  • limit (int) – Optional. If method is specified, this is the maximum number of consecutive NaN values to forward/backward fill. In other words, if there is a gap with more than this number of consecutive NaNs, it will only be partially filled. If method is not specified, this is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None. Default is None.

  • downcast (dict) – Optional. A dict of item->dtype of what to downcast if possible, or the string “infer” which will try to downcast to an appropriate equal type (e.g. float64 to int64 if possible). Default is None.

Returns

Array of input sequence with imputed values.

Return type

ndarray