group_by_data_label#

gaitmap_challenges.visualization.group_by_data_label(level: Union[int, str], include_all: Union[bool, str] = True, force_order: Optional[Sequence[str]] = None)[source]#

Create a grouper function that groups labels by the data label at the given level.

This returns a pd.Series mapping the original label to its group label.

Parameters:
level

The level to groupby. We assume that the original dataset had multiple levels. If an integer is passed, the level is assumed to be the index of the label. If a string is passed, the level is assumed to be the name of the level.

include_all

If True a group “all” is added that contains all labels. To customize the name of the group, pass a string.

force_order

If given, the order of the groups is forced to be the given order. Note, that this sequence must contain all groups (including “all” if include_all is True).