Skip to content

Commit

Permalink
Third Hotfix for get_milb_team_season_stats.py
Browse files Browse the repository at this point in the history
  • Loading branch information
armstjc committed Apr 1, 2024
1 parent 4869914 commit fad01f1
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions get_milb_team_season_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ def get_milb_team_season_stats(
return pd.DataFrame()

# # if len(json_data["stats"]) == 0:
if "stats" in json_data:
# If true, we don't have data.
if json_data["stats"] is None:
print(f"\nNo stats found in the {season} season.")
return pd.DataFrame()

elif "stats" in json_data:
pass
else:
print(f"\nNo stats found in the {season} season.")
return pd.DataFrame()

for i in json_data["stats"]:
row_df = pd.DataFrame({"season": season}, index=[0])
row_df["level_abv"] = level_abv
Expand Down Expand Up @@ -258,10 +262,19 @@ def get_milb_team_season_stats(
return pd.DataFrame()

# if len(json_data["stats"]) == 0:
if "stats" in json_data:
# If true, we don't have data.
if json_data["stats"] is None:
print(f"\nNo stats found in the {season} season.")
return pd.DataFrame()
elif "stats" in json_data:
pass
else:
print(f"\nNo stats found in the {season} season.")
return pd.DataFrame()

# if "stats" in json_data:
# if json_data.has_key("stats"):
# print("hecker")


for i in json_data["stats"]:
row_df = pd.DataFrame({"season": season}, index=[0])
Expand Down

0 comments on commit fad01f1

Please sign in to comment.