roclark / sportsipy

A free sports API written for python
MIT License
484 stars 187 forks source link

Pulling player positions #635

Open danielkmetz opened 3 years ago

danielkmetz commented 3 years ago

Describe the bug When trying to pull a player's position through team rosters, I am receiving an error that reads "NoneType", object is not subscriptable.

To Reproduce

DF2 = []
for year in ['2018', '2019', '2020']:
    for team in Teams(year):
        roster = team.roster
        for player in roster.players:
            DF2.append(
                {
                    'id': player.player_id,
                    'pos': player.position
                })

Expected behavior I'm expecting to return the player id and the corresponding position.

Desktop (please complete the following information):

kjsr7 commented 3 years ago

@danielkmetz Were you able to find an alternative/solution for this?

kjsr7 commented 3 years ago

I have tried using Player(id).dataframe.position, it gives the positions of the player over the years. But still, the positions of some players are missing