jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.18k stars 323 forks source link

Way to filter players by league? #324

Open rmatts94 opened 1 year ago

rmatts94 commented 1 year ago

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?

ghost commented 1 year ago

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.

tjburch commented 1 year ago

@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?