Utils for filling missing values¶
- darts.utils.missing_values.extract_subseries(series, min_gap_size=1, mode='all')[source]¶
Partitions the series into a sequence of sub-series by using significant gaps of missing values
- Parameters
series (
TimeSeries
) – The TimeSeries to partition into sub-seriesmin_gap_size (
Optional
[int
]) – The minimum number of contiguous missing values to consider a gap as significant. Defaults to 1.mode (
str
) – Only for multivariate TimeSeries. The definition of a gap; presence of a NaN in any column (“any”) or NaNs in all the columns (“all”) for a given timestamp. Defaults to “all”.
- Returns
A list of TimeSeries, sub-series without significant gaps of missing values
- Return type
subseries
See also
TimeSeries.gaps
return the gaps in the TimeSeries
- darts.utils.missing_values.fill_missing_values(series, fill='auto', **interpolate_kwargs)[source]¶
Fills missing values in the provided time series
- Parameters
series (
TimeSeries
) – The time series for which to fill missing valuesfill (
Union
[str
,float
]) – The value used to replace the missing values. If set to ‘auto’, will auto-fill missing values using the pandas.Dataframe.interpolate() method.interpolate_kwargs – Keyword arguments for pandas.Dataframe.interpolate(), only used when fit is set to ‘auto’. See the documentation for the list of supported parameters.
- Returns
A new TimeSeries with all missing values filled according to the rules above.
- Return type
- darts.utils.missing_values.missing_values_ratio(series)[source]¶
Computes the ratio of missing values
- Parameters
series (
TimeSeries
) – The time series to compute ratio on- Returns
The ratio of missing values
- Return type
float