eelib.utils.resample
Methods for inter- or extrapolating timeseries data (in pandas Dataframe format).
Module Contents
Functions
Computes the time resolution of a given timeseries. |
|
|
Resample a given DataFrame to a target time resolution. |
Attributes
- _logger
- get_resolution_pandas_timeseries(timeseries: pandas.DataFrame | pandas.Series) int
Computes the time resolution of a given timeseries.
TODO (1) handle if not DataFrame or Series (2) handle if not a DatetimeIndex
- Parameters:
timeseries (pd.DataFrame | pd.Series) – pandas Timeseries to determine resolution
- Returns:
time resolution in seconds
- Return type:
int
- resample_pandas_timeseries_agg(df: pandas.DataFrame, target_resolution: int, ffill_columns: list = [], distribute_columns: list = [], key: str = '') pandas.DataFrame
Resample a given DataFrame to a target time resolution.
Columns that must be uniformly distributed or just filled forward
- Parameters:
df (pd.DataFrame) – The df to be resampled.
target_resolution (int) – The resolution to be sampled in (seconds).
ffill_columns (list) – Columns to be filled forward. Defaults to [].
distribute_columns (list) – Columns to be distributed. Defaults to [].
key (str) – Key to describe the series (just for logging). Defaults to “”.
- Returns:
the resampled DataFrame
- Return type:
pd.DataFrame