In [1]:
Copied!
from kloppy import sportec
dataset = sportec.load_event(
event_data="../../kloppy/tests/files/sportec_events.xml",
meta_data="../../kloppy/tests/files/sportec_meta.xml",
# Optional arguments
coordinates="sportec",
event_types=["pass", "shot"]
)
dataset.to_df().head()
from kloppy import sportec
dataset = sportec.load_event(
event_data="../../kloppy/tests/files/sportec_events.xml",
meta_data="../../kloppy/tests/files/sportec_meta.xml",
# Optional arguments
coordinates="sportec",
event_types=["pass", "shot"]
)
dataset.to_df().head()
Out[1]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | player_id | coordinates_x | coordinates_y | end_coordinates_x | end_coordinates_y | receiver_player_id | set_piece_type | body_part_type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 17364900000006 | PASS | COMPLETE | True | 1 | 0.000 | None | alive | None | DFL-CLU-000004 | DFL-OBJ-0000SP | 56.41 | 68.00 | 77.75 | 38.71 | DFL-OBJ-0000ZS | KICK_OFF | None |
1 | 17364900000007 | PASS | COMPLETE | True | 1 | 3.123 | None | alive | None | DFL-CLU-000004 | DFL-OBJ-0000ZS | 73.94 | 37.21 | NaN | NaN | DFL-OBJ-002G3I | None | None |
2 | 17364900000014 | PASS | COMPLETE | True | 1 | 31.797 | None | alive | None | DFL-CLU-00000A | DFL-OBJ-00017V | 35.57 | 68.00 | 21.24 | 28.58 | DFL-OBJ-0027B9 | THROW_IN | None |
3 | 17364900000031 | SHOT | BLOCKED | False | 1 | 79.480 | None | alive | None | DFL-CLU-000004 | DFL-OBJ-002706 | 21.24 | 28.58 | NaN | NaN | None | None | RIGHT_FOOT |
4 | 17364900000036 | PASS | INCOMPLETE | False | 1 | 95.173 | None | alive | None | DFL-CLU-000004 | DFL-OBJ-002G3I | 8.72 | 4.21 | NaN | NaN | None | None | None |
Load local tracking files¶
In [3]:
Copied!
from kloppy import sportec
dataset = sportec.load_tracking(
raw_data="../../kloppy/tests/files/sportec_positional.xml",
meta_data="../../kloppy/tests/files/sportec_meta.xml",
# Optional arguments
coordinates="sportec",
only_alive=False
)
dataset.to_df().head()
from kloppy import sportec
dataset = sportec.load_tracking(
raw_data="../../kloppy/tests/files/sportec_positional.xml",
meta_data="../../kloppy/tests/files/sportec_meta.xml",
# Optional arguments
coordinates="sportec",
only_alive=False
)
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 | DFL-OBJ-002G3I_x | ... | DFL-OBJ-002G3I_d | DFL-OBJ-002G3I_s | DFL-OBJ-002G5S_x | DFL-OBJ-002G5S_y | DFL-OBJ-002G5S_d | DFL-OBJ-002G5S_s | DFL-OBJ-002FVJ_x | DFL-OBJ-002FVJ_y | DFL-OBJ-002FVJ_d | DFL-OBJ-002FVJ_s | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0.00 | 10000 | dead | DFL-CLU-000004 | 2.69 | 0.26 | 0.06 | 0.00 | 0.35 | ... | None | 0.00 | NaN | NaN | None | NaN | NaN | NaN | None | NaN |
1 | 1 | 0.04 | 10001 | alive | DFL-CLU-00000A | 3.41 | 0.26 | 0.08 | 65.59 | 0.34 | ... | None | 1.74 | NaN | NaN | None | NaN | NaN | NaN | None | NaN |
2 | 1 | 0.08 | 10002 | alive | DFL-CLU-000004 | 4.22 | 0.33 | 0.09 | 65.16 | 0.32 | ... | None | 1.76 | NaN | NaN | None | NaN | NaN | NaN | None | NaN |
3 | 1 | 0.12 | 10003 | alive | DFL-CLU-000004 | 5.02 | 0.38 | 0.09 | 74.34 | 0.31 | ... | None | 1.78 | NaN | NaN | None | NaN | NaN | NaN | None | NaN |
4 | 1 | 0.16 | 10004 | alive | DFL-CLU-000004 | 5.79 | 0.44 | 0.08 | 73.58 | 0.29 | ... | None | 1.80 | NaN | NaN | None | NaN | NaN | NaN | None | NaN |
5 rows × 21 columns
In [ ]:
Copied!