Skip to content

Commit

Permalink
hotfix on parse_statsbomb_data.py
Browse files Browse the repository at this point in the history
Hotfix on an edge case where the GSIS Player ID is not available for this player for some reason.
  • Loading branch information
armstjc committed Apr 1, 2024
1 parent dfbd25c commit c3dcefb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update_statsbomb_data_csv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_statsbomb_data_parquet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions check_data_advalibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)


def check_data_advalibility(
def check_data_availability(
check_csv: bool = False,
check_parquet: bool = False,
check_all_seasons: bool = True
Expand Down Expand Up @@ -123,12 +123,12 @@ def check_data_advalibility(
"files, or the `.parquet` files."
)
elif csv_flag is True:
check_data_advalibility(
check_data_availability(
check_csv=True,
check_all_seasons=check_all_seasons
)
elif parquet_flag is True:
check_data_advalibility(
check_data_availability(
check_parquet=True,
check_all_seasons=check_all_seasons
)
Expand Down
7 changes: 5 additions & 2 deletions parse_statsbomb_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def parse_statsbomb_amf_tracking_data(json_data: dict):
position_code = player["player"]["position_code"]
player_name = player["player"]["name"]
player_jersey_number = player["player"]["jersey_number"]
gsis_player_id = player["player"]["gsis_player_id"]
try:
gsis_player_id = player["player"]["gsis_player_id"]
except:
gsis_player_id = None
on_camera_ratio = player["on_camera_ratio"]

row_df = pd.DataFrame(player["steps"])
Expand Down Expand Up @@ -410,7 +413,7 @@ def get_statsbomb_tracking_data(season: int):

if __name__ == "__main__":
print("starting up")
for i in range(2018, 2024):
for i in range(2016, 2017):
get_statsbomb_tracking_data(i)

# get_statsbomb_tracking_data(2019)

0 comments on commit c3dcefb

Please sign in to comment.