groupby

groupby#

TrackData.groupby(column)[source]#

Splits tracks into groups based on a metadata column.

This method splits the tracks in the TrackData object into separate TrackData objects based on the unique values in the specified metadata column. It returns a dictionary where the keys are the unique values in the column, and the values are new TrackData objects containing the tracks corresponding to each key.

Parameters:

column (str) – The name of the metadata column to split by.

Return type:

dict[str, TrackData]

Returns:

A dictionary mapping unique values in the column to TrackData objects containing the corresponding tracks.