multilevel_groupby_apply_merge#

mobgap.utils.df_operations.multilevel_groupby_apply_merge(
df: DataFrame,
groupbys: list[tuple[str | list[str], Callable]],
**apply_kwargs: Any,
) DataFrame[source]#

Apply multiple groupby operations and merge the results.

This function allows to apply multiple groupby operations to a DataFrame and merge the results into a single DataFrame. The groupby operations are defined by a dictionary, where the keys are the groupby columns and the values are the aggregation functions to apply. All groupby results must have the same shape to be able to merge them.

Parameters:
df

The DataFrame to apply the groupby operations on.

groupbys

A dictionary where keys are the groupby columns and values are the aggregation functions to apply.

Returns:
pd.DataFrame

A DataFrame containing the results of the groupby operations.

Examples using mobgap.utils.df_operations.multilevel_groupby_apply_merge#

Walking speed estimation

Walking speed estimation

Cadence estimation

Cadence estimation

Stride length estimation

Stride length estimation

Performance of the gait sequences algorithm on the TVS dataset

Performance of the gait sequences algorithm on the TVS dataset

Performance of the initial contact algorithms on the TVS dataset

Performance of the initial contact algorithms on the TVS dataset

Performance of the cadence algorithms on the TVS dataset

Performance of the cadence algorithms on the TVS dataset

Performance of the stride length algorithms on the TVS dataset

Performance of the stride length algorithms on the TVS dataset