flasc.data_processing.time_operations.df_downsample#
- flasc.data_processing.time_operations.df_downsample(df_in, cols_angular, window_width=datetime.timedelta(seconds=60), min_periods=1, center=False, calc_median_min_max_std=False, return_index_mapping=False)[source]#
Downsample a dataframe to a average accounting for angular columns.
- Parameters:
df_in (pd.DataFrame | FlascDataFrame) -- Input dataframe.
cols_angular (list) -- List of angular columns.
window_width (timedelta) -- Width of the average window.
min_periods (int) -- Minimum number of data points for a bin to be valid.
center (bool) -- Center the time index. Default is False.
calc_median_min_max_std (bool) -- Calculate median, min, max, and std. Default is False.
return_index_mapping (bool) -- Return index mapping. Default is False.
- Returns:
- A tuple (pd.DataFrame, np.ndarray) if return_index_mapping is True. Where
the DataFrame is the downsampled dataframe and the np.ndarray is the index mapping.
A pd.DataFrame | FlascDataFrame if return_index_mapping is False.