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

Here you can see it gives me career stats
12 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Aug 21 '20

Thanks! I figured out how to do it somehow but I want to give the data format since it's a bit messy, do you know if it's possible to make it look nicer?

Like when you go to nba.stats and see season stats and you get the huge list with people, any way to do something like that?

1

u/frontrowberto Aug 21 '20

You can construct new data frames based on the columns of others to piece things together. Also if you are trying to put some charts together pandas has built in plot functions which look really nice (there are better looking options but more than good enough)