pymovements.Events.split#

Events.split(by: str | Sequence[str] | None = None, *, as_dict: Literal[False]) list[Events][source]#
Events.split(by: str | Sequence[str] | None = None, *, as_dict: Literal[True]) dict[tuple[Any, ...], Events]

Split the Events into multiple frames based on specified column(s).

Parameters:
  • by (str | Sequence[str] | None) – Column name(s) to split the Events by. If a single string is provided, it will be used as a single column name. If a list is provided, the Events will be split by unique combinations of values in all specified columns. If None, uses trial_columns. (default: None)

  • as_dict (bool) – Return a dictionary instead of a list. The dictionary keys are tuples of the distinct group values that identify each group split. (default: False)

Returns:

A collection of new Events instances, each containing a partition of the original data with all metadata and configurations preserved.

Return type:

list[Events] | dict[tuple[Any, …], Events]