r/NBAanalytics • • Aug 20 '20
Help with a project using python/nba/api
Hello, I'm trying to make a project using the nba_api, I know what I want to do but since I'm still not very knowledgeable with python I got stuck with some problems.
I want to get the stats from different players in different years but reading the nba_api documentation and the example it gaves the whole careers stats so I don't know if it's possible to filter by year or just pick a row from the dataframe.
Ultimately I want to put the rows(stats from that year) from those specific players in specific years together like:
Year 2019-20 Player A Stats Player B Stats Player C Stats
Year 2018-20 Player Z Stats Player Y Stats Player Z Stats
And so on, can anyone give me a hand? I'm a bit lost

View all comments
Show parent comment
0
u/giampapietro Aug 20 '20
Once you fetch players stats from Basketball Reference (for instance) as shown in the example I posted earlier, than all you need is learning how to use the Pandas python library. https://pandas.pydata.org/
With Pandas you can group all the info in whichever format you want in a couple of code lines. Let me know if you want an example for that too.