pybaseball
pybaseball copied to clipboard
Way to filter players by league?
Suppose I wanted players that only played in either the AL or NL? Is there a way to do that? Including situations where a player played for multiple teams?
In some of the data sources there is a column for which league they are in.
I would throw them into a pandas dataframe and then sort/ them by league.
@imzackadams is right here, particularly for the team_batting, team_pitching, etc functions. Otherwise, I think I'd just make a dictionary and merge it to the DF. Did you figure out how to get what you need?