pastas.utils.get_equidistant_series¶
- get_equidistant_series(series, freq, minimize_data_loss=False)[source]¶
Get equidistant timeseries using nearest reindexing.
This method will shift observations to the nearest equidistant timestep to create an equidistant timeseries, if necessary. Each observation is guaranteed to only be used once in the equidistant timeseries.
- Parameters
series (pandas.Series) – original (non-equidistant) timeseries
freq (str) – frequency of the new equidistant timeseries (i.e. “H”, “D”, “7D”, etc.)
minimize_data_loss (bool, optional) – if set to True, method will attempt use any unsampled points from original timeseries to fill some remaining NaNs in the new equidistant timeseries. Default is False. This only happens in rare cases.
- Returns
s – equidistant timeseries
- Return type
Notes
This method creates an equidistant timeseries with specified freq using nearest sampling (meaning observations can be shifted in time), with additional filling logic that ensures each original measurement is only included once in the new timeseries. Values are filled as close as possible to their original timestamp in the new equidistant timeseries.