:py:mod:`eelib.utils.resample` ============================== .. py:module:: eelib.utils.resample .. autoapi-nested-parse:: Methods for inter- or extrapolating timeseries data (in pandas Dataframe format). | Author: elenia@TUBS | Copyright 2024 elenia | This file is part of eELib, which is free software under the terms of the GNU GPL Version 3. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: eelib.utils.resample.get_resolution_pandas_timeseries eelib.utils.resample.resample_pandas_timeseries_agg Attributes ~~~~~~~~~~ .. autoapisummary:: eelib.utils.resample._logger .. py:data:: _logger .. py:function:: get_resolution_pandas_timeseries(timeseries: pandas.DataFrame | pandas.Series) -> int Computes the time resolution of a given timeseries. :param timeseries: pandas Timeseries to determine resolution :type timeseries: pd.DataFrame | pd.Series :raises TypeError: unexpected input format :returns: time resolution in seconds :rtype: int .. py:function:: resample_pandas_timeseries_agg(df: pandas.DataFrame, target_resolution: int, interpolation_method: str = 'linear', interpolation_params: dict = None, 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 :param df: The df to be resampled. :type df: pd.DataFrame :param target_resolution: The resolution to be sampled in (seconds). :type target_resolution: int :param interpolation_method: The method used for interpolation. :type interpolation_method: str :param interpolation_params: Additional parameters for interpoation, if needed. :type interpolation_params: dict :param ffill_columns: Columns to be filled forward. Defaults to []. :type ffill_columns: list :param distribute_columns: Columns to be distributed. Defaults to []. :type distribute_columns: list :param key: Key to describe the series (just for logging). Defaults to "". :type key: str :returns: the resampled DataFrame :rtype: pd.DataFrame