In [1]:
Copied!
from kloppy import secondspectrum
dataset = secondspectrum.load(
meta_data="../../kloppy/tests/files/second_spectrum_fake_metadata.xml",
raw_data="../../kloppy/tests/files/second_spectrum_fake_data.jsonl",
# Optional arguments
additional_meta_data="../../kloppy/tests/files/second_spectrum_fake_metadata.json",
sample_rate=1/25,
limit=100,
coordinates="secondspectrum",
only_alive=True
)
dataset.to_df().head()
from kloppy import secondspectrum
dataset = secondspectrum.load(
meta_data="../../kloppy/tests/files/second_spectrum_fake_metadata.xml",
raw_data="../../kloppy/tests/files/second_spectrum_fake_data.jsonl",
# Optional arguments
additional_meta_data="../../kloppy/tests/files/second_spectrum_fake_metadata.json",
sample_rate=1/25,
limit=100,
coordinates="secondspectrum",
only_alive=True
)
dataset.to_df().head()
Out[1]:
period_id | timestamp | frame_id | ball_state | ball_owning_team_id | ball_x | ball_y | ball_z | 20grw_x | 20grw_y | ... | 56zeu_d | 56zeu_s | 27cl51_x | 27cl51_y | 27cl51_d | 27cl51_s | eh90mu_x | eh90mu_y | eh90mu_d | eh90mu_s | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 160.00 | 4000 | alive | 456 | 48.434473 | -16.681311 | 0.0 | 46.299561 | -24.536171 | ... | None | None | 46.646914 | 25.246787 | None | None | 5.033404 | -21.188707 | None | None |
1 | 2 | 681.72 | 91600 | alive | 123 | 23.364446 | -16.856017 | 0.0 | 8.861703 | -33.088368 | ... | None | None | -48.850250 | -16.447842 | None | None | 15.112902 | 12.965995 | None | None |
2 rows × 96 columns
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
raw_data=s3://.../second_spectrum_fake_data.jsonl
)
Note: Kloppy might throw an the first time to help you identify missing cloud specific dependencies like s3fs
.
In [ ]:
Copied!
from kloppy import secondspectrum
dataset = secondspectrum.load(
meta_data="s3://.../second_spectrum_fake_metadata.xml",
raw_data="s3://.../second_spectrum_fake_data.jsonl",
# Optional arguments
additional_meta_data="s3://.../second_spectrum_fake_metadata.json",
sample_rate=1/25,
limit=100,
coordinates="secondspectrum",
only_alive=True
)
dataset.to_df().head()
from kloppy import secondspectrum
dataset = secondspectrum.load(
meta_data="s3://.../second_spectrum_fake_metadata.xml",
raw_data="s3://.../second_spectrum_fake_data.jsonl",
# Optional arguments
additional_meta_data="s3://.../second_spectrum_fake_metadata.json",
sample_rate=1/25,
limit=100,
coordinates="secondspectrum",
only_alive=True
)
dataset.to_df().head()