Dataset
kloppy.domain.Dataset
dataclass
Bases: ABC, Generic[T]
Base class for datasets.
A dataset describes specific aspects of what happened during a single
match as a sequence of DataRecord entities.
| ATTRIBUTE | DESCRIPTION |
|---|---|
dataset_type |
The type of the dataset.
TYPE:
|
records |
List of records in the dataset.
TYPE:
|
metadata |
Metadata for the dataset.
TYPE:
|
transform
filter
Filter all records used filter_
| PARAMETER | DESCRIPTION |
|---|---|
filter_
|
The filter to be used to filter the records. It can be a callable that takes a record and returns a boolean, or a string representing a css-like selector.
TYPE:
|
Examples:
1 2 3 | |
Source code in kloppy/domain/models/common.py
map
find_all
find
from_dataset
classmethod
Create a new Dataset from other dataset
| PARAMETER | DESCRIPTION |
|---|---|
mapper_fn
|
TYPE:
|
Examples:
>>> code_dataset = (
>>> CodeDataset
>>> .from_dataset(
>>> dataset,
>>> lambda event: Code(
>>> code_id=event.event_id,
>>> code=event.event_name,
>>> period=event.period,
>>> timestamp=event.timestamp - 7,
>>> end_timestamp=event.timestamp + 5,
>>> labels={
>>> 'Player': str(event.player),
>>> 'Team': str(event.team)
>>> }
>>> )
>>> )
>>> )
Source code in kloppy/domain/models/common.py
get_record_by_id
to_records
Source code in kloppy/domain/models/common.py
to_dict
Source code in kloppy/domain/models/common.py
to_df
Source code in kloppy/domain/models/common.py
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 | |