Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -95,10 +95,10 @@ def get_stats_from_boxScore_data(url: str, stat: str) -> dict:
|
|
95 |
stat_key = ('Basic Box Score Stats', stat)
|
96 |
for teams in box_scores.keys():
|
97 |
for player in box_scores[teams]:
|
98 |
-
if
|
99 |
-
if player[stat_key]
|
100 |
-
|
101 |
-
|
102 |
return stats
|
103 |
except Exception as e:
|
104 |
return {"Error": f"Error fetching boxScore data for given statistic: {str(e)}"}
|
|
|
95 |
stat_key = ('Basic Box Score Stats', stat)
|
96 |
for teams in box_scores.keys():
|
97 |
for player in box_scores[teams]:
|
98 |
+
if stat_key in player:
|
99 |
+
if player[stat_key] is not None:
|
100 |
+
if player[stat_key].replace('.', '').isdigit():
|
101 |
+
stats[player[list(player.keys())[0]]]=pd.to_numeric(player[stat_key], errors='coerce')
|
102 |
return stats
|
103 |
except Exception as e:
|
104 |
return {"Error": f"Error fetching boxScore data for given statistic: {str(e)}"}
|