In [1]:
Copied!
from kloppy import wyscout
dataset = wyscout.load(
event_data="../../kloppy/tests/files/wyscout_events.json",
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
from kloppy import wyscout
dataset = wyscout.load(
event_data="../../kloppy/tests/files/wyscout_events.json",
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
Out[1]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | ... | coordinates_x | coordinates_y | end_coordinates_x | end_coordinates_y | receiver_player_id | is_counter_attack | pass_type | set_piece_type | body_part_type | goalkeeper_action_type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 190078343 | PASS | COMPLETE | True | 1 | 2.643377 | None | None | None | 1612 | ... | 50.0 | 50.0 | 29.0 | 41.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
1 | 190078344 | PASS | INCOMPLETE | False | 1 | 4.350302 | None | None | None | 1612 | ... | 29.0 | 41.0 | 71.0 | 94.0 | NaN | False | HIGH_PASS | NaN | NaN | NaN |
2 | 190079073 | PASS | INCOMPLETE | False | 1 | 8.010654 | None | None | None | 1631 | ... | 29.0 | 6.0 | 36.0 | 3.0 | NaN | False | HEAD_PASS | NaN | NaN | NaN |
3 | 190079074 | PASS | COMPLETE | True | 1 | 14.934050 | None | None | None | 1631 | ... | 39.0 | 0.0 | 41.0 | 13.0 | NaN | False | HAND_PASS | THROW_IN | NaN | NaN |
4 | 190079076 | PASS | COMPLETE | True | 1 | 16.013375 | None | None | None | 1631 | ... | 41.0 | 13.0 | 63.0 | 15.0 | NaN | False | HIGH_PASS | NaN | NaN | NaN |
5 rows × 21 columns
Load remote files¶
You can also directly read files from urls (http or https) by passing a url instead of a local path.
In [2]:
Copied!
from kloppy import wyscout
dataset = wyscout.load(
event_data="https://raw.githubusercontent.com/koenvo/wyscout-soccer-match-event-dataset/main/processed/files/1694390.json",
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
from kloppy import wyscout
dataset = wyscout.load(
event_data="https://raw.githubusercontent.com/koenvo/wyscout-soccer-match-event-dataset/main/processed/files/1694390.json",
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
Out[2]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | ... | coordinates_x | coordinates_y | end_coordinates_x | end_coordinates_y | receiver_player_id | is_counter_attack | pass_type | set_piece_type | goalkeeper_action_type | body_part_type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 88178642 | PASS | COMPLETE | True | 1 | 1.255990 | None | None | None | 4418 | ... | 50.0 | 48.0 | 47.0 | 50.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
1 | 88178643 | PASS | COMPLETE | True | 1 | 2.351908 | None | None | None | 4418 | ... | 47.0 | 50.0 | 41.0 | 48.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
2 | 88178644 | PASS | COMPLETE | True | 1 | 3.241028 | None | None | None | 4418 | ... | 41.0 | 48.0 | 32.0 | 35.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
3 | 88178645 | PASS | INCOMPLETE | False | 1 | 6.033681 | None | None | None | 4418 | ... | 32.0 | 35.0 | 89.0 | 6.0 | NaN | False | HIGH_PASS | NaN | NaN | NaN |
4 | 88178648 | PASS | INCOMPLETE | False | 1 | 27.053006 | None | None | None | 4418 | ... | 85.0 | 0.0 | 93.0 | 16.0 | NaN | False | HAND_PASS | THROW_IN | NaN | NaN |
5 rows × 21 columns
Load open data¶
For loading Wyscout open data you can also use statsbomb.load_open_data. The api is very simular but you don't have to pass the urls.
In [3]:
Copied!
from kloppy import wyscout
dataset = wyscout.load_open_data(
match_id=1694390,
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
from kloppy import wyscout
dataset = wyscout.load_open_data(
match_id=1694390,
# Optional arguments
event_types=["shot", "pass"],
coordinates="wyscout"
)
dataset.to_df().head()
Out[3]:
event_id | event_type | result | success | period_id | timestamp | end_timestamp | ball_state | ball_owning_team | team_id | ... | coordinates_x | coordinates_y | end_coordinates_x | end_coordinates_y | receiver_player_id | is_counter_attack | pass_type | set_piece_type | goalkeeper_action_type | body_part_type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 88178642 | PASS | COMPLETE | True | 1 | 1.255990 | None | None | None | 4418 | ... | 50.0 | 48.0 | 47.0 | 50.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
1 | 88178643 | PASS | COMPLETE | True | 1 | 2.351908 | None | None | None | 4418 | ... | 47.0 | 50.0 | 41.0 | 48.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
2 | 88178644 | PASS | COMPLETE | True | 1 | 3.241028 | None | None | None | 4418 | ... | 41.0 | 48.0 | 32.0 | 35.0 | NaN | False | SIMPLE_PASS | NaN | NaN | NaN |
3 | 88178645 | PASS | INCOMPLETE | False | 1 | 6.033681 | None | None | None | 4418 | ... | 32.0 | 35.0 | 89.0 | 6.0 | NaN | False | HIGH_PASS | NaN | NaN | NaN |
4 | 88178648 | PASS | INCOMPLETE | False | 1 | 27.053006 | None | None | None | 4418 | ... | 85.0 | 0.0 | 93.0 | 16.0 | NaN | False | HAND_PASS | THROW_IN | NaN | NaN |
5 rows × 21 columns