In [1]:
Copied!
from kloppy import statsperform
dataset = statsperform.load_event(
ma1_data="../../kloppy/tests/files/statsperform_event_ma1.json",
ma3_data="../../kloppy/tests/files/statsperform_event_ma3.json",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
from kloppy import statsperform
dataset = statsperform.load_event(
ma1_data="../../kloppy/tests/files/statsperform_event_ma1.json",
ma3_data="../../kloppy/tests/files/statsperform_event_ma3.json",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
Out[1]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | ... | end_coordinates_x | end_coordinates_y | receiver_player_id | set_piece_type | pass_type | body_part_type | goalkeeper_type | duel_type | card_type | is_counter_attack | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2328589789 | PASS | COMPLETE | True | 1 | 0 days 00:00:00.030000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 33.670365 | 51.121324 | None | KICK_OFF | None | None | None | None | None | None |
1 | 2328589863 | PASS | COMPLETE | True | 1 | 0 days 00:00:02.075000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 33.777624 | 89.003624 | None | None | None | None | None | None | None | None |
2 | 2328589885 | PASS | COMPLETE | True | 1 | 0 days 00:00:06.803000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 55.906349 | 92.958461 | None | None | CHIPPED_PASS | None | None | None | None | None |
3 | 2328589929 | PASS | COMPLETE | True | 1 | 0 days 00:00:09.373000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 48.063492 | 96.720379 | None | None | None | None | None | None | None | None |
4 | 2328589997 | GENERIC:foul | None | None | 1 | 0 days 00:00:11.695000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | NaN | NaN | None | None | None | None | None | None | None | None |
5 rows × 23 columns
In [2]:
Copied!
from kloppy import statsperform
dataset = statsperform.load_event(
ma1_data="../../kloppy/tests/files/statsperform_event_ma1.xml",
ma3_data="../../kloppy/tests/files/statsperform_event_ma3.xml",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
from kloppy import statsperform
dataset = statsperform.load_event(
ma1_data="../../kloppy/tests/files/statsperform_event_ma1.xml",
ma3_data="../../kloppy/tests/files/statsperform_event_ma3.xml",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
Out[2]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | ... | end_coordinates_x | end_coordinates_y | receiver_player_id | set_piece_type | pass_type | body_part_type | goalkeeper_type | duel_type | card_type | is_counter_attack | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2328589789 | PASS | COMPLETE | True | 1 | 0 days 00:00:00.030000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 33.670365 | 51.121324 | None | KICK_OFF | None | None | None | None | None | None |
1 | 2328589863 | PASS | COMPLETE | True | 1 | 0 days 00:00:02.075000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 33.777624 | 89.003624 | None | None | None | None | None | None | None | None |
2 | 2328589885 | PASS | COMPLETE | True | 1 | 0 days 00:00:06.803000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 55.906349 | 92.958461 | None | None | CHIPPED_PASS | None | None | None | None | None |
3 | 2328589929 | PASS | COMPLETE | True | 1 | 0 days 00:00:09.373000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | 48.063492 | 96.720379 | None | None | None | None | None | None | None | None |
4 | 2328589997 | GENERIC:foul | None | None | 1 | 0 days 00:00:11.695000 | None | alive | 75xi6hloabmnjn2kzgj1g8h1s | 75xi6hloabmnjn2kzgj1g8h1s | ... | NaN | NaN | None | None | None | None | None | None | None | None |
5 rows × 23 columns
Load local tracking files¶
In [4]:
Copied!
from kloppy import statsperform
dataset = statsperform.load_tracking(
ma1_data="../../kloppy/tests/files/statsperform_tracking_ma1.json",
ma25_data="../../kloppy/tests/files/statsperform_tracking_ma25.txt",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
from kloppy import statsperform
dataset = statsperform.load_tracking(
ma1_data="../../kloppy/tests/files/statsperform_tracking_ma1.json",
ma25_data="../../kloppy/tests/files/statsperform_tracking_ma25.txt",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
Out[4]:
period_id | timestamp | frame_id | ball_state | ball_owning_team_id | ball_x | ball_y | ball_z | ball_speed | a2s2c6anax9wnlsw1s6vunl5h_x | ... | 6wfwy94p5bm0zv3aku0urfq39_d | 6wfwy94p5bm0zv3aku0urfq39_s | 6ekdnbnk56xlxforb5owt3dn9_x | 6ekdnbnk56xlxforb5owt3dn9_y | 6ekdnbnk56xlxforb5owt3dn9_d | 6ekdnbnk56xlxforb5owt3dn9_s | ct32113pfx5q9avf2c0x208ru_x | ct32113pfx5q9avf2c0x208ru_y | ct32113pfx5q9avf2c0x208ru_d | ct32113pfx5q9avf2c0x208ru_s | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0 days 00:00:00 | 1598184000000 | alive | None | 52.350 | 33.250 | 0.0 | None | 52.803 | ... | None | None | 5.268 | 33.556 | None | None | NaN | NaN | None | None |
1 | 1 | 0 days 00:00:00.100000 | 1598184000100 | alive | None | 50.615 | 35.325 | 0.0 | None | 52.558 | ... | None | None | 5.265 | 33.529 | None | None | NaN | NaN | None | None |
2 | 1 | 0 days 00:00:00.200000 | 1598184000200 | alive | None | 49.630 | 36.140 | 0.0 | None | 52.310 | ... | None | None | 5.264 | 33.502 | None | None | NaN | NaN | None | None |
3 | 1 | 0 days 00:00:00.300000 | 1598184000300 | alive | None | 48.725 | 36.625 | 0.0 | None | 52.059 | ... | None | None | 5.268 | 33.476 | None | None | NaN | NaN | None | None |
4 | 1 | 0 days 00:00:00.400000 | 1598184000400 | alive | None | 47.890 | 37.130 | 0.0 | None | 51.804 | ... | None | None | 5.277 | 33.452 | None | None | NaN | NaN | None | None |
5 rows × 101 columns
In [3]:
Copied!
from kloppy import statsperform
dataset = statsperform.load_tracking(
ma1_data="../../kloppy/tests/files/statsperform_tracking_ma1.xml",
ma25_data="../../kloppy/tests/files/statsperform_tracking_ma25.txt",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
from kloppy import statsperform
dataset = statsperform.load_tracking(
ma1_data="../../kloppy/tests/files/statsperform_tracking_ma1.xml",
ma25_data="../../kloppy/tests/files/statsperform_tracking_ma25.txt",
# Optional arguments
coordinates="statsperform"
)
dataset.to_df().head()
Out[3]:
period_id | timestamp | frame_id | ball_state | ball_owning_team_id | ball_x | ball_y | ball_z | ball_speed | a2s2c6anax9wnlsw1s6vunl5h_x | ... | 6wfwy94p5bm0zv3aku0urfq39_d | 6wfwy94p5bm0zv3aku0urfq39_s | 6ekdnbnk56xlxforb5owt3dn9_x | 6ekdnbnk56xlxforb5owt3dn9_y | 6ekdnbnk56xlxforb5owt3dn9_d | 6ekdnbnk56xlxforb5owt3dn9_s | ct32113pfx5q9avf2c0x208ru_x | ct32113pfx5q9avf2c0x208ru_y | ct32113pfx5q9avf2c0x208ru_d | ct32113pfx5q9avf2c0x208ru_s | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0 days 00:00:00 | 1598184000000 | alive | None | 52.350 | 33.250 | 0.0 | None | 52.803 | ... | None | None | 5.268 | 33.556 | None | None | NaN | NaN | None | None |
1 | 1 | 0 days 00:00:00.100000 | 1598184000100 | alive | None | 50.615 | 35.325 | 0.0 | None | 52.558 | ... | None | None | 5.265 | 33.529 | None | None | NaN | NaN | None | None |
2 | 1 | 0 days 00:00:00.200000 | 1598184000200 | alive | None | 49.630 | 36.140 | 0.0 | None | 52.310 | ... | None | None | 5.264 | 33.502 | None | None | NaN | NaN | None | None |
3 | 1 | 0 days 00:00:00.300000 | 1598184000300 | alive | None | 48.725 | 36.625 | 0.0 | None | 52.059 | ... | None | None | 5.268 | 33.476 | None | None | NaN | NaN | None | None |
4 | 1 | 0 days 00:00:00.400000 | 1598184000400 | alive | None | 47.890 | 37.130 | 0.0 | None | 51.804 | ... | None | None | 5.277 | 33.452 | None | None | NaN | NaN | None | None |
5 rows × 101 columns