You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use `statsapi.get()` to call the sports_players endpoint for the 2008 World Series,
121
+
lookup Chase Utley's person id from the results, and pass it into `statsapi.player_stats()`
122
+
using `type='hitting'` and `group='career'`
123
+
124
+
print( statsapi.player_stats(next(x['id'] for x in statsapi.get('sports_players',{'season':2008,'gameType':'W'})['people'] if x['fullName']=='Chase Utley'), 'hitting', 'career') )
"""Get current season or career stats for a given player.
626
+
627
+
For group use 'hitting', 'pitching', or 'fielding'.
628
+
Include multiple groups in the following format (this is a string, not actually a list):
629
+
group='[hitting,pitching]'
630
+
631
+
For type use 'career' or 'season'.
632
+
Include multiple types in the following format (this is a string, not actually a list):
633
+
group='[career,season]'
634
+
635
+
Example use:
636
+
637
+
Print Chase Utley's career hitting stats (using sports_players endpoint to look up person id)
638
+
639
+
print( statsapi.player_stats(next(x['id'] for x in statsapi.get('sports_players',{'season':2008,'gameType':'W'})['people'] if x['fullName']=='Chase Utley'), 'hitting', 'career') )
0 commit comments