-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a978f29
commit bd0b175
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
"# nba_api" | ||
# NBA API demo | ||
|
||
A proof-of-concept / demo for the `nba_api` | ||
|
||
# To create the environment from scratch | ||
conda create -n nba python=3.12 | ||
conda activate nba | ||
conda install pandas | ||
pip install nba_api | ||
|
||
Then run | ||
``` | ||
python main.py | ||
``` | ||
|
||
Expect to see a large printout of a dictionary object beginning: | ||
``` | ||
PLAYER_ID SEASON_ID LEAGUE_ID TEAM_ID TEAM_ABBREVIATION PLAYER_AGE GP ... REB AST STL BLK TOV PF PTS | ||
0 203999 2015-16 00 1610612743 DEN 21.0 80 ... 560 189 79 50 104 208 796 | ||
1 203999 2016-17 00 1610612743 DEN 22.0 73 ... 718 359 61 55 171 214 1221 | ||
2 203999 2017-18 00 1610612743 DEN 23.0 75 ... 803 458 90 61 210 212 1385 | ||
``` | ||
|
||
We are using the API library: | ||
https://github.com/swar/nba_api | ||
|
||
There may be additional data available at through other libraries. See: | ||
https://medium.com/@cristianvaldez85/nba-data-using-python-82ebc0e19398 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from nba_api.stats.endpoints import playercareerstats | ||
|
||
# Nikola Jokić | ||
career = playercareerstats.PlayerCareerStats(player_id='203999') | ||
|
||
# pandas data frames (optional: pip install pandas) | ||
print(career.get_data_frames()[0]) | ||
|
||
# dictionary | ||
# print(career.get_dict()) |