In [1]:
Copied!
from kloppy import tracab
dataset = tracab.load(
meta_data="../../kloppy/tests/files/tracab_meta.xml",
raw_data="../../kloppy/tests/files/tracab_raw.dat",
# Optional arguments
sample_rate=1/2,
limit=10,
coordinates="tracab",
only_alive=True
)
# Because this is a test dataset the output contains some garbage
dataset.to_df().head()
from kloppy import tracab
dataset = tracab.load(
meta_data="../../kloppy/tests/files/tracab_meta.xml",
raw_data="../../kloppy/tests/files/tracab_raw.dat",
# Optional arguments
sample_rate=1/2,
limit=10,
coordinates="tracab",
only_alive=True
)
# Because this is a test dataset the output contains some garbage
dataset.to_df().head()
Out[1]:
period_id | timestamp | frame_id | ball_state | ball_owning_team_id | ball_x | ball_y | ball_z | away_19_x | away_19_y | away_19_d | away_19_s | home_19_x | home_19_y | home_19_d | home_19_s | away_1337_x | away_1337_y | away_1337_d | away_1337_s | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0.00 | 100 | alive | home | -27.0 | 25.0 | 0.0 | 8889.0 | -666.0 | NaN | 0.55 | -1234.0 | -294.0 | None | 0.07 | NaN | NaN | NaN | NaN |
1 | 2 | 0.00 | 200 | alive | home | -27.0 | 25.0 | 0.0 | NaN | NaN | NaN | NaN | -1234.0 | -294.0 | None | 0.07 | -8889.0 | -666.0 | NaN | 0.55 |
2 | 2 | 0.08 | 202 | alive | home | -27.0 | 25.0 | 0.0 | NaN | NaN | NaN | NaN | -1234.0 | -294.0 | None | 0.07 | -8889.0 | -666.0 | NaN | 0.55 |
Load remote files¶
Kloppy supports remote files through fsspec
FileSystem under the hood. This allows you to work with files in AWS S3, Google Cloud, Azure Blob, HDFS, FTP, and SFTP without extra tools.
For example you can pass:
- Individual s3 file paths: (e.g
meta_data=s3://.../tracab_meta.xml
)
Note: Kloppy might throw an the first time to help you identify missing cloud specific dependencies like s3fs
.
In [ ]:
Copied!
from kloppy import tracab
dataset = tracab.load(
meta_data="s3://.../tracab_meta.xml",
raw_data="s3://.../tracab_raw.dat",
# Optional arguments
sample_rate=1/2,
limit=10,
coordinates="tracab",
only_alive=True
)
from kloppy import tracab
dataset = tracab.load(
meta_data="s3://.../tracab_meta.xml",
raw_data="s3://.../tracab_raw.dat",
# Optional arguments
sample_rate=1/2,
limit=10,
coordinates="tracab",
only_alive=True
)