Skip to content

Tracking

Dataset

kloppy.domain.models.tracking.TrackingDataset (Dataset) dataclass

TrackingDataset(args, *kwds)

filter(self, filter_fn) inherited

Filter all records used filter_fn

Parameters:

Name Type Description Default
- filter_fn required

Examples:

>>> from kloppy.domain import EventType
>>> dataset = dataset.filter(lambda event: event.event_type == EventType.PASS)
Source code in kloppy/domain/models/tracking.py
def filter(self, filter_fn: Callable[[DataRecord], bool]):
    """
    Filter all records used `filter_fn`

    Arguments:
        - filter_fn:

    Examples:
        >>> from kloppy.domain import EventType
        >>> dataset = dataset.filter(lambda event: event.event_type == EventType.PASS)
    """
    return replace(
        self,
        records=[record for record in self.records if filter_fn(record)],
    )

transform(self, *args, **kwargs) inherited

See [transform][kloppy.helpers.transform]

Source code in kloppy/domain/models/tracking.py
def transform(self, *args, **kwargs):
    """
    See [transform][kloppy.helpers.transform]
    """
    from kloppy.helpers import transform

    return transform(self, *args, **kwargs)