NBA Statistics Resources

This notebook is intended to document resources for obtaining particular types of NBA Statistics, provide examples on how to make requests, show what the response looks like and what kinds of operations can readily be performed on it.


In [1]:
import requests
from pandas import DataFrame

Individual Players Seasonal Game Log


In [2]:
params = {
    'PlayerID': 951, # Jesus Shuttlesworth
    'Season': '2013-14',
    'SeasonType': 'Regular Season'
}
r = requests.get('http://stats.nba.com/stats/playergamelog', params=params)

In [93]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(['Player_ID', 'SEASON_ID', 'Game_ID']); df


Out[93]:
GAME_DATE MATCHUP WL MIN FGM FGA FG_PCT FG3M FG3A FG3_PCT ... DREB REB AST STL BLK TOV PF PTS PLUS_MINUS VIDEO_AVAILABLE
Player_ID SEASON_ID Game_ID
951 22013 0021301225 APR 16, 2014 MIA vs. PHI L 24 4 9 0.444 1 5 0.200 ... 3 3 3 0 0 1 0 11 -4 1
0021301206 APR 14, 2014 MIA @ WAS L 19 4 7 0.571 3 5 0.600 ... 2 2 1 1 0 0 1 13 -11 1
0021301192 APR 12, 2014 MIA @ ATL L 24 1 2 0.500 1 2 0.500 ... 0 0 1 0 0 0 1 3 -6 1
0021301180 APR 11, 2014 MIA vs. IND W 29 3 7 0.429 1 3 0.333 ... 4 4 2 2 0 2 2 10 2 1
0021301167 APR 09, 2014 MIA @ MEM L 25 2 4 0.500 2 4 0.500 ... 0 0 2 2 0 1 1 6 -5 1
0021301158 APR 08, 2014 MIA vs. BKN L 23 2 5 0.400 2 4 0.500 ... 3 4 0 0 1 1 4 6 2 1
0021301149 APR 06, 2014 MIA vs. NYK W 29 4 10 0.400 4 9 0.444 ... 1 1 1 1 0 1 1 12 15 1
0021301135 APR 04, 2014 MIA vs. MIN L 28 4 10 0.400 2 6 0.333 ... 2 3 1 2 0 1 4 10 1 1
0021301049 MAR 24, 2014 MIA vs. POR W 32 3 10 0.300 2 4 0.500 ... 3 3 3 0 0 0 2 8 -12 1
0021301036 MAR 22, 2014 MIA @ NOP L 31 3 10 0.300 2 9 0.222 ... 3 3 1 0 0 2 0 10 -10 1
0021301027 MAR 21, 2014 MIA vs. MEM W 31 7 14 0.500 2 5 0.400 ... 3 4 4 0 0 0 2 18 20 1
0021301009 MAR 19, 2014 MIA @ BOS L 32 5 11 0.455 1 4 0.250 ... 1 1 1 2 0 0 0 14 3 1
0021301003 MAR 18, 2014 MIA @ CLE W 30 5 13 0.385 2 9 0.222 ... 1 3 2 0 0 3 1 14 -5 1
0021300989 MAR 16, 2014 MIA vs. HOU W 29 7 11 0.636 4 6 0.667 ... 1 1 0 0 0 0 1 25 7 1
0021300976 MAR 14, 2014 MIA vs. DEN L 29 7 9 0.778 5 7 0.714 ... 3 4 2 1 0 1 3 22 14 1
0021300957 MAR 12, 2014 MIA vs. BKN L 28 0 3 0.000 0 3 0.000 ... 3 3 1 0 0 0 1 1 1 1
0021300945 MAR 10, 2014 MIA vs. WAS W 29 5 9 0.556 3 6 0.500 ... 2 3 2 0 0 0 1 13 3 1
0021300934 MAR 09, 2014 MIA @ CHI L 21 2 5 0.400 2 3 0.667 ... 1 1 0 0 0 1 0 7 -12 1
0021300914 MAR 06, 2014 MIA @ SAS L 22 2 5 0.400 1 3 0.333 ... 1 1 5 0 1 3 1 6 -11 1
0021300900 MAR 04, 2014 MIA @ HOU L 26 5 8 0.625 2 5 0.400 ... 3 4 1 1 0 0 1 13 11 1
0021300893 MAR 03, 2014 MIA vs. CHA W 30 3 7 0.429 3 5 0.600 ... 3 3 4 0 0 0 4 9 14 1
0021300874 MAR 01, 2014 MIA vs. ORL W 24 3 7 0.429 1 4 0.250 ... 1 1 1 0 0 1 0 7 11 2
0021300865 FEB 27, 2014 MIA vs. NYK W 20 4 6 0.667 1 3 0.333 ... 1 2 3 0 0 1 0 11 18 1
0021300834 FEB 23, 2014 MIA vs. CHI W 31 4 8 0.500 2 3 0.667 ... 5 5 0 0 0 0 1 10 18 1
0021300813 FEB 20, 2014 MIA @ OKC W 25 2 6 0.333 1 3 0.333 ... 3 3 1 1 0 1 0 6 3 1
0021300798 FEB 18, 2014 MIA @ DAL W 22 0 5 0.000 0 3 0.000 ... 1 1 1 0 0 0 1 0 4 1
0021300788 FEB 12, 2014 MIA @ GSW W 31 3 7 0.429 3 5 0.600 ... 3 3 3 2 0 0 2 9 -8 1
0021300774 FEB 11, 2014 MIA @ PHX W 29 3 6 0.500 1 4 0.250 ... 7 7 3 1 0 2 1 7 12 1
0021300755 FEB 08, 2014 MIA @ UTA L 23 4 8 0.500 1 4 0.250 ... 0 0 1 1 0 1 1 9 -5 1
0021300736 FEB 05, 2014 MIA @ LAC W 27 4 8 0.500 2 5 0.400 ... 0 0 2 1 0 2 3 15 -6 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... JAN 05, 2014 MIA vs. TOR W 25 1 7 0.143 0 4 0.000 ... 1 2 3 1 0 1 1 6 1 1
0021300500 JAN 04, 2014 MIA @ ORL W 18 0 4 0.000 0 2 0.000 ... 1 1 0 0 0 0 3 1 3 1
0021300490 JAN 02, 2014 MIA vs. GSW L 20 1 4 0.250 0 1 0.000 ... 0 0 2 0 0 0 3 5 7 1
0021300474 DEC 30, 2013 MIA @ DEN W 31 4 7 0.571 2 4 0.500 ... 6 7 2 0 0 1 1 13 -10 1
0021300457 DEC 28, 2013 MIA @ POR W 26 4 11 0.364 1 6 0.167 ... 2 2 2 3 0 1 1 9 -6 1
0021300446 DEC 25, 2013 MIA @ LAL W 21 4 5 0.800 4 5 0.800 ... 2 2 2 1 1 0 1 12 -5 1
0021300420 DEC 23, 2013 MIA vs. ATL W 34 7 10 0.700 1 4 0.250 ... 5 6 1 0 0 2 1 19 -3 1
0021300411 DEC 20, 2013 MIA vs. SAC W 26 8 13 0.615 2 6 0.333 ... 1 1 5 1 0 4 4 18 2 1
0021300387 DEC 18, 2013 MIA vs. IND W 27 2 6 0.333 1 4 0.250 ... 6 7 3 1 0 0 0 7 -1 1
0021300369 DEC 16, 2013 MIA vs. UTA W 24 2 6 0.333 1 4 0.250 ... 4 4 1 1 0 3 1 5 0 1
0021300360 DEC 14, 2013 MIA vs. CLE W 25 3 5 0.600 2 4 0.500 ... 2 2 2 1 0 3 4 12 13 1
0021300344 DEC 10, 2013 MIA @ IND L 26 1 5 0.200 1 1 1.000 ... 1 1 2 1 1 1 1 3 0 1
0021300311 DEC 08, 2013 MIA @ DET W 25 6 10 0.600 2 5 0.400 ... 1 1 3 1 0 0 1 18 15 1
0021300300 DEC 07, 2013 MIA @ MIN W 21 4 8 0.500 0 3 0.000 ... 3 3 2 2 0 2 2 11 13 1
0021300294 DEC 05, 2013 MIA @ CHI L 27 2 4 0.500 1 3 0.333 ... 1 1 1 1 0 0 2 9 -13 1
0021300279 DEC 03, 2013 MIA vs. DET L 29 5 10 0.500 2 4 0.500 ... 2 4 1 1 0 3 2 12 1 1
0021300264 DEC 01, 2013 MIA vs. CHA W 16 1 4 0.250 0 1 0.000 ... 0 0 2 2 0 2 4 2 -3 1
0021300252 NOV 29, 2013 MIA @ TOR W 24 3 8 0.375 1 1 1.000 ... 0 0 4 0 0 3 4 7 -8 1
0021300230 NOV 27, 2013 MIA @ CLE W 20 3 9 0.333 1 4 0.250 ... 3 3 2 1 1 0 3 7 5 1
0021300219 NOV 25, 2013 MIA vs. PHX W 25 6 11 0.545 3 8 0.375 ... 3 3 1 2 1 2 0 17 17 1
0021300205 NOV 23, 2013 MIA vs. ORL W 26 1 5 0.200 1 3 0.333 ... 2 3 2 0 0 1 1 5 0 1
0021300191 NOV 20, 2013 MIA @ ORL W 20 2 8 0.250 2 3 0.667 ... 1 2 0 1 0 3 0 6 3 1
0021300164 NOV 19, 2013 MIA vs. ATL W 25 5 10 0.500 3 6 0.500 ... 2 3 1 1 0 2 1 17 0 1
0021300158 NOV 09, 2013 MIA vs. BOS L 24 2 4 0.500 0 1 0.000 ... 4 4 3 0 0 1 1 5 -6 1
0021300089 NOV 07, 2013 MIA vs. LAC W 26 5 8 0.625 0 3 0.000 ... 1 1 2 1 0 0 0 12 14 1
0021300070 NOV 05, 2013 MIA @ TOR W 30 5 11 0.455 3 7 0.429 ... 4 4 2 1 0 2 3 14 21 1
0021300051 NOV 03, 2013 MIA vs. WAS W 31 2 5 0.400 0 2 0.000 ... 2 3 6 0 0 0 2 4 3 1
0021300042 NOV 01, 2013 MIA @ BKN L 29 4 6 0.667 1 2 0.500 ... 4 4 2 1 0 0 0 12 10 1
0021300028 OCT 30, 2013 MIA @ PHI L 28 7 13 0.538 4 9 0.444 ... 5 6 1 2 0 0 0 19 1 1
0021300005 OCT 29, 2013 MIA vs. CHI W 26 3 7 0.429 3 6 0.500 ... 1 1 7 0 1 3 4 11 9 1

73 rows × 24 columns

Summarize the data for us.


In [4]:
df.describe()


Out[4]:
MIN FGM FGA FG_PCT FG3M FG3A FG3_PCT FTM FTA FT_PCT ... DREB REB AST STL BLK TOV PF PTS PLUS_MINUS VIDEO_AVAILABLE
count 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 ... 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000 73.000000
mean 26.534247 3.287671 7.438356 0.426932 1.589041 4.232877 0.363219 1.438356 1.589041 0.528767 ... 2.493151 2.808219 1.958904 0.739726 0.109589 1.150685 1.575342 9.602740 2.219178 1.013699
std 4.885017 1.896484 2.793774 0.187429 1.211469 1.882083 0.253959 1.632877 1.801509 0.478835 ... 1.803725 1.934034 1.447588 0.727007 0.314539 1.126342 1.322012 5.206139 10.030850 0.117041
min 15.000000 0.000000 2.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -24.000000 1.000000
25% 24.000000 2.000000 5.000000 0.333000 1.000000 3.000000 0.222000 0.000000 0.000000 0.000000 ... 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 6.000000 -5.000000 1.000000
50% 26.000000 3.000000 7.000000 0.429000 1.000000 4.000000 0.333000 1.000000 1.000000 0.750000 ... 2.000000 3.000000 2.000000 1.000000 0.000000 1.000000 1.000000 9.000000 2.000000 1.000000
75% 29.000000 4.000000 10.000000 0.500000 2.000000 5.000000 0.500000 3.000000 3.000000 1.000000 ... 3.000000 4.000000 3.000000 1.000000 0.000000 2.000000 2.000000 12.000000 10.000000 1.000000
max 43.000000 8.000000 14.000000 1.000000 5.000000 9.000000 1.000000 7.000000 7.000000 1.000000 ... 9.000000 9.000000 7.000000 3.000000 1.000000 4.000000 5.000000 25.000000 22.000000 2.000000

8 rows × 21 columns

Players List


In [5]:
params = {
    'LeagueID': '00',
    'Season': '2013-14',
    'IsOnlyCurrentSeason': 0
}
r = requests.get('http://stats.nba.com/stats/commonallplayers', params=params)

In [6]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('PERSON_ID'); df


Out[6]:
DISPLAY_LAST_COMMA_FIRST ROSTERSTATUS FROM_YEAR TO_YEAR PLAYERCODE
PERSON_ID
76001 Abdelnaby, Alaa 0 1990 1994 HISTADD_alaa_abdelnaby
76002 Abdul-Aziz, Zaid 0 1968 1977 HISTADD_zaid_abdul-aziz
76003 Abdul-Jabbar, Kareem 0 1969 1988 HISTADD_kareem_abdul-jabbar
51 Abdul-Rauf, Mahmoud 0 1990 2000 HISTADD_mahmoud_abdul-rauf
1505 Abdul-Wahad, Tariq 0 1997 2003 tariq_abdul-wahad
949 Abdur-Rahim, Shareef 0 1996 2007 shareef_abdur-rahim
76005 Abernethy, Tom 0 1976 1980 HISTADD_tom_abernethy
76006 Able, Forest 0 1956 1956 HISTADD_frosty_able
76007 Abramovic, John 0 1946 1947 HISTADD_brooms_abramovic
101165 Acker, Alex 0 2005 2008 alex_acker
76008 Ackerman, Donald 0 1953 1953 HISTADD_buddy_ackerman
76009 Acres, Mark 0 1987 1992 HISTADD_mark_acres
76010 Acton, Charles 0 1967 1967 HISTADD_bud_acton
203112 Acy, Quincy 1 2012 2014 quincy_acy
76011 Adams, Alvan 0 1975 1987 HISTADD_alvan_adams
76012 Adams, Don 0 1970 1976 HISTADD_don_adams
200801 Adams, Hassan 0 2006 2008 hassan_adams
203919 Adams, Jordan 0 2014 2014 jordan_adams
149 Adams, Michael 0 1985 1995 HISTADD_michael_adams
203500 Adams, Steven 1 2013 2014 steven_adams
912 Addison, Rafael 0 1986 1996 HISTADD_rafael_addison
76015 Adelman, Rick 0 1968 1974 HISTADD_rick_adelman
202399 Adrien, Jeff 1 2010 2014 jeff_adrien
201167 Afflalo, Arron 1 2007 2014 arron_afflalo
200772 Ager, Maurice 0 2006 2010 maurice_ager
76016 Aguirre, Mark 0 1981 1993 HISTADD_mark_aguirre
201336 Ahearn, Blake 0 2007 2011 blake_ahearn
76017 Ainge, Danny 0 1981 1994 HISTADD_danny_ainge
201582 Ajinca, Alexis 1 2008 2014 alexis_ajinca
76018 Akin, Henry 0 1966 1967 HISTADD_henry_akin
... ... ... ... ... ...
78631 Yelverton, Charlie 0 1971 1971 HISTADD_charlie_yelverton
201146 Yi Jianlian 0 2007 2011 yi_jianlian
78632 Yonakor, Rich 0 1981 1981 HISTADD_rich_yonakor
78633 Young, Danny 0 1984 1994 HISTADD_danny_young
203923 Young, James 0 2014 2014 james_young
1748 Young, Korleone 0 1998 1998 HISTADD_korleone_young
78634 Young, Michael 0 1984 1989 HISTADD_michael_young
201156 Young, Nick 1 2007 2014 nick_young
203942 Young, Patric 0 2014 2014 patric_young
78635 Young, Perry 0 1986 1986 HISTADD_perry_young
201970 Young, Sam 0 2009 2012 sam_young
201152 Young, Thaddeus 1 2007 2014 thaddeus_young
1937 Young, Tim 0 1999 1999 HISTADD_tim_young
201180 Yue, Sun 0 2008 2008 sun_yue
78638 Zaslofsky, Max 0 1946 1955 HISTADD_slats_zaslofsky
78639 Zawoluk, Robert 0 1952 1954 HISTADD_zeke_zawoluk
203469 Zeller, Cody 1 2013 2014 cody_zeller
78640 Zeller, Dave 0 1961 1961 HISTADD_dave_zeller
78641 Zeller, Gary 0 1970 1971 HISTADD_gary_zeller
78642 Zeller, Hank 0 1946 1946 HISTADD_hank_zeller
202545 Zeller, Luke 0 2012 2012 luke_zeller
203092 Zeller, Tyler 1 2012 2014 tyler_zeller
78643 Zeno, Tony 0 1979 1979 HISTADD_tony_zeno
78644 Zevenbergen, Phil 0 1987 1987 HISTADD_phil_zevenbergen
1917 Zhi-zhi, Wang 0 2000 2004 wang_zhizhi
678 Zidek, George 0 1995 1997 george_zidek
2583 Zimmerman, Derrick 0 2005 2005 derrick_zimmerman
78647 Zoet, Jim 0 1982 1982 HISTADD_jim_zoet
78648 Zopf, Bill 0 1970 1970 HISTADD_zip_zopf
78650 Zunic, Matt 0 1948 1948 HISTADD_matt_zunic

3990 rows × 5 columns

You'd be surprised how far a list like this can take us. By way of example, we can easily obtain an image of "Swaggy P" like so:


In [7]:
from IPython.display import Image
Image('http://i.cdn.turner.com/nba/nba/.element/img/2.0/sect/statscube/players/large/{player_code}.png' \
      .format(player_code=df[df.DISPLAY_LAST_COMMA_FIRST=='Young, Nick'].iloc[0]['PLAYERCODE']))


Out[7]:

I'm sure you get the gist. In reality, this list will be much more useful as a starting point for a bot/spider to following each individual player's details.

Player Stats Profile


In [84]:
params = {
    'PlayerID' : 201167, # Arron Afflalo
    'LeagueID' : '00',
    'Season' : '2013-14',
    'SeasonType' : 'Regular Season',
    'GraphStartSeason' : '',
    'GraphEndSeason' : '',
    'GraphStat' : 'PTS',
}
r = requests.get('http://stats.nba.com/stats/playerprofile', params=params)

This one is interesting because it produces a bunch of different results.


In [85]:
result_dict = {data[u'name']: DataFrame(data[u'rowSet'], columns=data[u'headers']) for data in r.json()[u'resultSets']}; result_dict


Out[85]:
{u'GameLogs':    Player_ID     Game_ID     GAME_DATE      MATCHUP WL  MIN  FGM  FGA  FG_PCT  \
 0     201167  0021301227  APR 16, 2014  ORL vs. IND  L    6    2    2   1.000   
 1     201167  0021301208  APR 14, 2014    ORL @ CHI  L   22    5    7   0.714   
 2     201167  0021301199  APR 13, 2014    ORL @ BKN  L   21    2    7   0.286   
 3     201167  0021301176  APR 11, 2014  ORL vs. WAS  L   31    6   14   0.429   
 4     201167  0021301163  APR 09, 2014  ORL vs. BKN  W   33    9   16   0.563   
 5     201167  0021301143  APR 05, 2014  ORL vs. MIN  W   30    8   15   0.533   
 6     201167  0021301130  APR 04, 2014    ORL @ CHA  L   23    2   10   0.200   
 7     201167  0021301116  APR 02, 2014  ORL vs. CLE  L   29    3   10   0.300   
 8     201167  0021301096  MAR 30, 2014  ORL vs. TOR  L   36    3    9   0.333   
 9     201167  0021301075  MAR 28, 2014  ORL vs. CHA  W   39    3    9   0.333   
 
    FG3M  ...   OREB  DREB  REB  AST  STL  BLK  TOV  PF  PTS  PLUS_MINUS  
 0     1  ...      0     1    1    1    1    0    1   0    7           4  
 1     1  ...      0     1    1    1    0    0    2   2   13           3  
 2     1  ...      0     0    0    5    0    0    0   1    5           2  
 3     1  ...      0     2    2    1    1    0    2   0   19          -1  
 4     2  ...      1     3    4    5    0    0    1   4   25         -14  
 5     1  ...      0     3    3    2    0    0    4   2   18          -5  
 6     0  ...      1     2    3    0    0    0    1   1    8         -21  
 7     1  ...      0     4    4    5    0    1    0   0    7         -18  
 8     1  ...      2     0    2    2    0    0    2   3    8           1  
 9     2  ...      0     2    2    1    0    0    3   1   17          -6  
 
 [10 rows x 25 columns],
 u'GraphGameList':     PLAYER_ID    PLAYER_NAME     GAME_ID   GAME_DATE TEAM_ABBREVIATION  \
 0      201167  Arron Afflalo  0021300001  10/29/2013               ORL   
 1      201167  Arron Afflalo  0021300010  10/30/2013               ORL   
 2      201167  Arron Afflalo  0021300021  11/01/2013               ORL   
 3      201167  Arron Afflalo  0021300043  11/03/2013               ORL   
 4      201167  Arron Afflalo  0021300062  11/06/2013               ORL   
 5      201167  Arron Afflalo  0021300075  11/08/2013               ORL   
 6      201167  Arron Afflalo  0021300086  11/09/2013               ORL   
 7      201167  Arron Afflalo  0021300101  11/11/2013               ORL   
 8      201167  Arron Afflalo  0021300111  11/13/2013               ORL   
 9      201167  Arron Afflalo  0021300137  11/16/2013               ORL   
 10     201167  Arron Afflalo  0021300164  11/20/2013               ORL   
 11     201167  Arron Afflalo  0021300191  11/23/2013               ORL   
 12     201167  Arron Afflalo  0021300199  11/24/2013               ORL   
 13     201167  Arron Afflalo  0021300213  11/26/2013               ORL   
 14     201167  Arron Afflalo  0021300216  11/27/2013               ORL   
 15     201167  Arron Afflalo  0021300229  11/29/2013               ORL   
 16     201167  Arron Afflalo  0021300256  12/02/2013               ORL   
 17     201167  Arron Afflalo  0021300261  12/03/2013               ORL   
 18     201167  Arron Afflalo  0021300284  12/06/2013               ORL   
 19     201167  Arron Afflalo  0021300301  12/08/2013               ORL   
 20     201167  Arron Afflalo  0021300307  12/09/2013               ORL   
 21     201167  Arron Afflalo  0021300318  12/11/2013               ORL   
 22     201167  Arron Afflalo  0021300330  12/13/2013               ORL   
 23     201167  Arron Afflalo  0021300353  12/15/2013               ORL   
 24     201167  Arron Afflalo  0021300362  12/16/2013               ORL   
 25     201167  Arron Afflalo  0021300395  12/21/2013               ORL   
 26     201167  Arron Afflalo  0021300409  12/23/2013               ORL   
 27     201167  Arron Afflalo  0021300428  12/27/2013               ORL   
 28     201167  Arron Afflalo  0021300449  12/29/2013               ORL   
 29     201167  Arron Afflalo  0021300462  12/31/2013               ORL   
 ..        ...            ...         ...         ...               ...   
 43     201167  Arron Afflalo  0021300689  01/31/2014               ORL   
 44     201167  Arron Afflalo  0021300709  02/02/2014               ORL   
 45     201167  Arron Afflalo  0021300710  02/03/2014               ORL   
 46     201167  Arron Afflalo  0021300733  02/05/2014               ORL   
 47     201167  Arron Afflalo  0021300740  02/07/2014               ORL   
 48     201167  Arron Afflalo  0021300761  02/09/2014               ORL   
 49     201167  Arron Afflalo  0021300778  02/12/2014               ORL   
 50     201167  Arron Afflalo  0021300797  02/18/2014               ORL   
 51     201167  Arron Afflalo  0021300802  02/19/2014               ORL   
 52     201167  Arron Afflalo  0021300816  02/21/2014               ORL   
 53     201167  Arron Afflalo  0021300905  03/05/2014               ORL   
 54     201167  Arron Afflalo  0021300932  03/08/2014               ORL   
 55     201167  Arron Afflalo  0021300947  03/10/2014               ORL   
 56     201167  Arron Afflalo  0021300958  03/12/2014               ORL   
 57     201167  Arron Afflalo  0021300972  03/14/2014               ORL   
 58     201167  Arron Afflalo  0021301007  03/18/2014               ORL   
 59     201167  Arron Afflalo  0021301016  03/19/2014               ORL   
 60     201167  Arron Afflalo  0021301037  03/22/2014               ORL   
 61     201167  Arron Afflalo  0021301046  03/23/2014               ORL   
 62     201167  Arron Afflalo  0021301058  03/25/2014               ORL   
 63     201167  Arron Afflalo  0021301075  03/28/2014               ORL   
 64     201167  Arron Afflalo  0021301096  03/30/2014               ORL   
 65     201167  Arron Afflalo  0021301116  04/02/2014               ORL   
 66     201167  Arron Afflalo  0021301130  04/04/2014               ORL   
 67     201167  Arron Afflalo  0021301143  04/05/2014               ORL   
 68     201167  Arron Afflalo  0021301163  04/09/2014               ORL   
 69     201167  Arron Afflalo  0021301176  04/11/2014               ORL   
 70     201167  Arron Afflalo  0021301199  04/13/2014               ORL   
 71     201167  Arron Afflalo  0021301208  04/14/2014               ORL   
 72     201167  Arron Afflalo  0021301227  04/16/2014               ORL   
 
    TEAM_NAME  VS_TEAM_ID VS_TEAM_ABBREVIATION   VS_TEAM_NAME  PTS  
 0      Magic  1610612754                  IND         Pacers    9  
 1      Magic  1610612750                  MIN   Timberwolves   28  
 2      Magic  1610612740                  NOP       Pelicans   30  
 3      Magic  1610612751                  BKN           Nets   16  
 4      Magic  1610612746                  LAC       Clippers   11  
 5      Magic  1610612738                  BOS        Celtics   23  
 6      Magic  1610612737                  ATL          Hawks   21  
 7      Magic  1610612738                  BOS        Celtics   18  
 8      Magic  1610612749                  MIL          Bucks   36  
 9      Magic  1610612742                  DAL      Mavericks   25  
 10     Magic  1610612748                  MIA           Heat   30  
 11     Magic  1610612748                  MIA           Heat   18  
 12     Magic  1610612756                  PHX           Suns   16  
 13     Magic  1610612737                  ATL          Hawks   26  
 14     Magic  1610612755                  PHI          76ers   18  
 15     Magic  1610612759                  SAS          Spurs   17  
 16     Magic  1610612764                  WAS        Wizards   21  
 17     Magic  1610612755                  PHI          76ers   43  
 18     Magic  1610612752                  NYK         Knicks   20  
 19     Magic  1610612745                  HOU        Rockets   16  
 20     Magic  1610612763                  MEM      Grizzlies   17  
 21     Magic  1610612766                  CHA        Bobcats   16  
 22     Magic  1610612739                  CLE      Cavaliers   17  
 23     Magic  1610612760                  OKC        Thunder   25  
 24     Magic  1610612741                  CHI          Bulls   23  
 25     Magic  1610612758                  SAC          Kings   26  
 26     Magic  1610612752                  NYK         Knicks   26  
 27     Magic  1610612765                  DET        Pistons   23  
 28     Magic  1610612737                  ATL          Hawks   21  
 29     Magic  1610612744                  GSW       Warriors   15  
 ..       ...         ...                  ...            ...  ...  
 43     Magic  1610612749                  MIL          Bucks   21  
 44     Magic  1610612738                  BOS        Celtics   18  
 45     Magic  1610612754                  IND         Pacers   20  
 46     Magic  1610612765                  DET        Pistons   15  
 47     Magic  1610612760                  OKC        Thunder   16  
 48     Magic  1610612754                  IND         Pacers    7  
 49     Magic  1610612763                  MEM      Grizzlies   10  
 50     Magic  1610612749                  MIL          Bucks   21  
 51     Magic  1610612739                  CLE      Cavaliers   23  
 52     Magic  1610612752                  NYK         Knicks   32  
 53     Magic  1610612745                  HOU        Rockets   18  
 54     Magic  1610612759                  SAS          Spurs   17  
 55     Magic  1610612749                  MIL          Bucks   12  
 56     Magic  1610612743                  DEN        Nuggets   24  
 57     Magic  1610612764                  WAS        Wizards   18  
 58     Magic  1610612744                  GSW       Warriors    4  
 59     Magic  1610612756                  PHX           Suns   20  
 60     Magic  1610612762                  UTA           Jazz   18  
 61     Magic  1610612747                  LAL         Lakers   18  
 62     Magic  1610612757                  POR  Trail Blazers   10  
 63     Magic  1610612766                  CHA        Bobcats   17  
 64     Magic  1610612761                  TOR        Raptors    8  
 65     Magic  1610612739                  CLE      Cavaliers    7  
 66     Magic  1610612766                  CHA        Bobcats    8  
 67     Magic  1610612750                  MIN   Timberwolves   18  
 68     Magic  1610612751                  BKN           Nets   25  
 69     Magic  1610612764                  WAS        Wizards   19  
 70     Magic  1610612751                  BKN           Nets    5  
 71     Magic  1610612741                  CHI          Bulls   13  
 72     Magic  1610612754                  IND         Pacers    7  
 
 [73 rows x 10 columns],
 u'GraphLeagueAvg':    PTS
 0  9.7,
 u'GraphPlayerAvg':    PLAYER_ID    PLAYER_NAME   PTS
 0     201167  Arron Afflalo  18.2,
 u'OverviewCareerAvg':    PLAYER_ID    PLAYER_NAME   MIN  FGM  FGA  FG_PCT  FG3M  FG3A  FG3_PCT  FTM  \
 0     201167  Arron Afflalo  27.4    4  8.8   0.459   1.1   2.8    0.392    2   
 
   ...   FT_PCT  OREB  DREB  REB  AST  TOV  STL  BLK  PF   PTS  
 0 ...    0.815   0.5   2.4  2.9    2  1.2  0.5  0.2   2  11.1  
 
 [1 rows x 21 columns],
 u'OverviewCareerHigh':    PLAYER_ID    PLAYER_NAME  MIN  FGM   FGA  FG_PCT  FG3M  FG3A  FG3_PCT  FTM  \
 0     201167  Arron Afflalo   36  6.4  14.1   0.498   1.8   4.1    0.434  3.8   
 
   ...   FT_PCT  OREB  DREB  REB  AST  TOV  STL  BLK   PF   PTS  
 0 ...    0.857   0.7   3.3  3.7  3.4  2.2  0.6  0.4  2.7  18.2  
 
 [1 rows x 21 columns],
 u'OverviewCareerTotal':    PLAYER_ID    PLAYER_NAME    MIN   FGM   FGA  FG_PCT  FG3M  FG3A  FG3_PCT  \
 0     201167  Arron Afflalo  13694  2004  4368   0.459   554  1413    0.392   
 
    FTM ...   FT_PCT  OREB  DREB   REB   AST  TOV  STL  BLK    PF   PTS  
 0  998 ...    0.815   271  1201  1472  1005  591  250  109  1012  5560  
 
 [1 rows x 21 columns],
 u'OverviewSeasonAvg':    PLAYER_ID    PLAYER_NAME  GP   W   L  W_PCT  MIN  FGM   FGA  FG_PCT  \
 0     201167  Arron Afflalo  73  21  52  0.288   35  6.4  13.8   0.459   
 
     ...    TOV  STL  BLK  BLKA   PF  PFD   PTS  PLUS_MINUS  DD2  TD3  
 0   ...      2  0.5    0   0.8  1.9  3.3  18.2          -5    1    0  
 
 [1 rows x 30 columns],
 u'OverviewSeasonHigh':    PLAYER_ID    PLAYER_NAME  GP        MIN  FGM  FGA  FG_PCT  FG3M  FG3A  \
 0     201167  Arron Afflalo  73  52.416667   14   27       1     8    13   
 
    FG3_PCT   ...     REB  AST  TOV  STL  BLK  BLKA  PF  PFD  PTS  PLUS_MINUS  
 0        1   ...      13    8    6    2    1     3   5    9   43          18  
 
 [1 rows x 25 columns]}

These are the names of the results returned.


In [86]:
result_dict.keys()


Out[86]:
[u'OverviewSeasonHigh',
 u'GameLogs',
 u'GraphGameList',
 u'OverviewCareerAvg',
 u'GraphLeagueAvg',
 u'OverviewCareerTotal',
 u'OverviewCareerHigh',
 u'OverviewSeasonAvg',
 u'GraphPlayerAvg']

Let's check one of them out.


In [87]:
result_dict['GameLogs'].set_index(['Player_ID', 'Game_ID'])


Out[87]:
GAME_DATE MATCHUP WL MIN FGM FGA FG_PCT FG3M FG3A FG3_PCT ... OREB DREB REB AST STL BLK TOV PF PTS PLUS_MINUS
Player_ID Game_ID
201167 0021301227 APR 16, 2014 ORL vs. IND L 6 2 2 1.000 1 1 1.00 ... 0 1 1 1 1 0 1 0 7 4
0021301208 APR 14, 2014 ORL @ CHI L 22 5 7 0.714 1 1 1.00 ... 0 1 1 1 0 0 2 2 13 3
0021301199 APR 13, 2014 ORL @ BKN L 21 2 7 0.286 1 2 0.50 ... 0 0 0 5 0 0 0 1 5 2
0021301176 APR 11, 2014 ORL vs. WAS L 31 6 14 0.429 1 4 0.25 ... 0 2 2 1 1 0 2 0 19 -1
0021301163 APR 09, 2014 ORL vs. BKN W 33 9 16 0.563 2 5 0.40 ... 1 3 4 5 0 0 1 4 25 -14
0021301143 APR 05, 2014 ORL vs. MIN W 30 8 15 0.533 1 4 0.25 ... 0 3 3 2 0 0 4 2 18 -5
0021301130 APR 04, 2014 ORL @ CHA L 23 2 10 0.200 0 2 0.00 ... 1 2 3 0 0 0 1 1 8 -21
0021301116 APR 02, 2014 ORL vs. CLE L 29 3 10 0.300 1 5 0.20 ... 0 4 4 5 0 1 0 0 7 -18
0021301096 MAR 30, 2014 ORL vs. TOR L 36 3 9 0.333 1 4 0.25 ... 2 0 2 2 0 0 2 3 8 1
0021301075 MAR 28, 2014 ORL vs. CHA W 39 3 9 0.333 2 4 0.50 ... 0 2 2 1 0 0 3 1 17 -6

10 rows × 23 columns

This is actually not unlike the playergamelog view we saw above.


In [89]:
result_dict[u'GraphGameList'].set_index(['PLAYER_ID', 'GAME_ID'])


Out[89]:
PLAYER_NAME GAME_DATE TEAM_ABBREVIATION TEAM_NAME VS_TEAM_ID VS_TEAM_ABBREVIATION VS_TEAM_NAME PTS
PLAYER_ID GAME_ID
201167 0021300001 Arron Afflalo 10/29/2013 ORL Magic 1610612754 IND Pacers 9
0021300010 Arron Afflalo 10/30/2013 ORL Magic 1610612750 MIN Timberwolves 28
0021300021 Arron Afflalo 11/01/2013 ORL Magic 1610612740 NOP Pelicans 30
0021300043 Arron Afflalo 11/03/2013 ORL Magic 1610612751 BKN Nets 16
0021300062 Arron Afflalo 11/06/2013 ORL Magic 1610612746 LAC Clippers 11
0021300075 Arron Afflalo 11/08/2013 ORL Magic 1610612738 BOS Celtics 23
0021300086 Arron Afflalo 11/09/2013 ORL Magic 1610612737 ATL Hawks 21
0021300101 Arron Afflalo 11/11/2013 ORL Magic 1610612738 BOS Celtics 18
0021300111 Arron Afflalo 11/13/2013 ORL Magic 1610612749 MIL Bucks 36
0021300137 Arron Afflalo 11/16/2013 ORL Magic 1610612742 DAL Mavericks 25
0021300164 Arron Afflalo 11/20/2013 ORL Magic 1610612748 MIA Heat 30
0021300191 Arron Afflalo 11/23/2013 ORL Magic 1610612748 MIA Heat 18
0021300199 Arron Afflalo 11/24/2013 ORL Magic 1610612756 PHX Suns 16
0021300213 Arron Afflalo 11/26/2013 ORL Magic 1610612737 ATL Hawks 26
0021300216 Arron Afflalo 11/27/2013 ORL Magic 1610612755 PHI 76ers 18
0021300229 Arron Afflalo 11/29/2013 ORL Magic 1610612759 SAS Spurs 17
0021300256 Arron Afflalo 12/02/2013 ORL Magic 1610612764 WAS Wizards 21
0021300261 Arron Afflalo 12/03/2013 ORL Magic 1610612755 PHI 76ers 43
0021300284 Arron Afflalo 12/06/2013 ORL Magic 1610612752 NYK Knicks 20
0021300301 Arron Afflalo 12/08/2013 ORL Magic 1610612745 HOU Rockets 16
0021300307 Arron Afflalo 12/09/2013 ORL Magic 1610612763 MEM Grizzlies 17
0021300318 Arron Afflalo 12/11/2013 ORL Magic 1610612766 CHA Bobcats 16
0021300330 Arron Afflalo 12/13/2013 ORL Magic 1610612739 CLE Cavaliers 17
0021300353 Arron Afflalo 12/15/2013 ORL Magic 1610612760 OKC Thunder 25
0021300362 Arron Afflalo 12/16/2013 ORL Magic 1610612741 CHI Bulls 23
0021300395 Arron Afflalo 12/21/2013 ORL Magic 1610612758 SAC Kings 26
0021300409 Arron Afflalo 12/23/2013 ORL Magic 1610612752 NYK Knicks 26
0021300428 Arron Afflalo 12/27/2013 ORL Magic 1610612765 DET Pistons 23
0021300449 Arron Afflalo 12/29/2013 ORL Magic 1610612737 ATL Hawks 21
0021300462 Arron Afflalo 12/31/2013 ORL Magic 1610612744 GSW Warriors 15
... ... ... ... ... ... ... ... ...
0021300689 Arron Afflalo 01/31/2014 ORL Magic 1610612749 MIL Bucks 21
0021300709 Arron Afflalo 02/02/2014 ORL Magic 1610612738 BOS Celtics 18
0021300710 Arron Afflalo 02/03/2014 ORL Magic 1610612754 IND Pacers 20
0021300733 Arron Afflalo 02/05/2014 ORL Magic 1610612765 DET Pistons 15
0021300740 Arron Afflalo 02/07/2014 ORL Magic 1610612760 OKC Thunder 16
0021300761 Arron Afflalo 02/09/2014 ORL Magic 1610612754 IND Pacers 7
0021300778 Arron Afflalo 02/12/2014 ORL Magic 1610612763 MEM Grizzlies 10
0021300797 Arron Afflalo 02/18/2014 ORL Magic 1610612749 MIL Bucks 21
0021300802 Arron Afflalo 02/19/2014 ORL Magic 1610612739 CLE Cavaliers 23
0021300816 Arron Afflalo 02/21/2014 ORL Magic 1610612752 NYK Knicks 32
0021300905 Arron Afflalo 03/05/2014 ORL Magic 1610612745 HOU Rockets 18
0021300932 Arron Afflalo 03/08/2014 ORL Magic 1610612759 SAS Spurs 17
0021300947 Arron Afflalo 03/10/2014 ORL Magic 1610612749 MIL Bucks 12
0021300958 Arron Afflalo 03/12/2014 ORL Magic 1610612743 DEN Nuggets 24
0021300972 Arron Afflalo 03/14/2014 ORL Magic 1610612764 WAS Wizards 18
0021301007 Arron Afflalo 03/18/2014 ORL Magic 1610612744 GSW Warriors 4
0021301016 Arron Afflalo 03/19/2014 ORL Magic 1610612756 PHX Suns 20
0021301037 Arron Afflalo 03/22/2014 ORL Magic 1610612762 UTA Jazz 18
0021301046 Arron Afflalo 03/23/2014 ORL Magic 1610612747 LAL Lakers 18
0021301058 Arron Afflalo 03/25/2014 ORL Magic 1610612757 POR Trail Blazers 10
0021301075 Arron Afflalo 03/28/2014 ORL Magic 1610612766 CHA Bobcats 17
0021301096 Arron Afflalo 03/30/2014 ORL Magic 1610612761 TOR Raptors 8
0021301116 Arron Afflalo 04/02/2014 ORL Magic 1610612739 CLE Cavaliers 7
0021301130 Arron Afflalo 04/04/2014 ORL Magic 1610612766 CHA Bobcats 8
0021301143 Arron Afflalo 04/05/2014 ORL Magic 1610612750 MIN Timberwolves 18
0021301163 Arron Afflalo 04/09/2014 ORL Magic 1610612751 BKN Nets 25
0021301176 Arron Afflalo 04/11/2014 ORL Magic 1610612764 WAS Wizards 19
0021301199 Arron Afflalo 04/13/2014 ORL Magic 1610612751 BKN Nets 5
0021301208 Arron Afflalo 04/14/2014 ORL Magic 1610612741 CHI Bulls 13
0021301227 Arron Afflalo 04/16/2014 ORL Magic 1610612754 IND Pacers 7

73 rows × 8 columns

Little summary... That's cool I guess. This view doesn't seem all that interesting to be honest, save maybe for the career summary which is of limited use to us. Let's move on.

Player Information


In [16]:
params = {
    'PlayerID': 76003 # Kareem Abdul-Jabbar
}
r = requests.get('http://stats.nba.com/stats/commonplayerinfo/', params=params)

In [20]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('PERSON_ID'); df


Out[20]:
FIRST_NAME LAST_NAME DISPLAY_FIRST_LAST DISPLAY_LAST_COMMA_FIRST DISPLAY_FI_LAST BIRTHDATE SCHOOL COUNTRY LAST_AFFILIATION JERSEY POSITION ROSTERSTATUS TEAM_ID TEAM_NAME TEAM_ABBREVIATION TEAM_CODE TEAM_CITY PLAYERCODE
PERSON_ID
76003 Kareem Abdul-Jabbar Kareem Abdul-Jabbar Abdul-Jabbar, Kareem K. Abdul-Jabbar 1947-04-16T00:00:00 UCLA US UCLA/US 33 Center Active 1610612747 Lakers LAL lakers Los Angeles HISTADD_kareem_abdul-jabbar

Not sure why ROSTERSTATUS is active here...

Player Awards and Honours


In [22]:
params = {
    'PlayerID': 76003 # Kareem Abdul-Jabbar
}
r = requests.get('http://stats.nba.com/feeds/players/awards/{PlayerID}_Award.js'.format(**params))

In [23]:
data = r.json(); data


Out[23]:
{u'PlayerAwards': [{u'Award': [{u'AwardName': u'All-Defensive Team',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIADT',
     u'Team': u'1'},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(315550800000-0500)/',
       u'Year': u'1980-81'},
      {u'SortOrder': u'/Date(284014800000-0500)/', u'Year': u'1979-80'},
      {u'SortOrder': u'/Date(252478800000-0500)/', u'Year': u'1978-79'},
      {u'SortOrder': u'/Date(126248400000-0500)/', u'Year': u'1974-75'},
      {u'SortOrder': u'/Date(94712400000-0500)/', u'Year': u'1973-74'}]}]},
  {u'Award': [{u'AwardName': u'All-Defensive Team',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIADT',
     u'Team': u'2'},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(410245200000-0500)/',
       u'Year': u'1983-84'},
      {u'SortOrder': u'/Date(220942800000-0500)/', u'Year': u'1977-78'},
      {u'SortOrder': u'/Date(189320400000-0500)/', u'Year': u'1976-77'},
      {u'SortOrder': u'/Date(157784400000-0500)/', u'Year': u'1975-76'},
      {u'SortOrder': u'/Date(18000000-0500)/', u'Year': u'1970-71'},
      {u'SortOrder': u'/Date(-31518000000-0500)/', u'Year': u'1969-70'}]}]},
  {u'Award': [{u'AwardName': u'All-NBA',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIANT',
     u'Team': u'1'},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(473403600000-0500)/',
       u'Year': u'1985-86'},
      {u'SortOrder': u'/Date(410245200000-0500)/', u'Year': u'1983-84'},
      {u'SortOrder': u'/Date(315550800000-0500)/', u'Year': u'1980-81'},
      {u'SortOrder': u'/Date(284014800000-0500)/', u'Year': u'1979-80'},
      {u'SortOrder': u'/Date(189320400000-0500)/', u'Year': u'1976-77'},
      {u'SortOrder': u'/Date(157784400000-0500)/', u'Year': u'1975-76'},
      {u'SortOrder': u'/Date(94712400000-0500)/', u'Year': u'1973-74'},
      {u'SortOrder': u'/Date(63090000000-0500)/', u'Year': u'1972-73'},
      {u'SortOrder': u'/Date(31554000000-0500)/', u'Year': u'1971-72'},
      {u'SortOrder': u'/Date(18000000-0500)/', u'Year': u'1970-71'}]}]},
  {u'Award': [{u'AwardName': u'All-NBA',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIANT',
     u'Team': u'2'},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(441781200000-0500)/',
       u'Year': u'1984-85'},
      {u'SortOrder': u'/Date(378709200000-0500)/', u'Year': u'1982-83'},
      {u'SortOrder': u'/Date(252478800000-0500)/', u'Year': u'1978-79'},
      {u'SortOrder': u'/Date(220942800000-0500)/', u'Year': u'1977-78'},
      {u'SortOrder': u'/Date(-31518000000-0500)/', u'Year': u'1969-70'}]}]},
  {u'Award': [{u'AwardName': u'All-Rookie Team',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIART',
     u'Team': u'1'},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(-31518000000-0500)/',
       u'Year': u'1969-70'}]}]},
  {u'Award': [{u'AwardName': u'Hall of Fame Inductee',
     u'SubType1': u'Hall of Fame',
     u'SubType2': u' ',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(788936400000-0500)/',
       u'Year': u'1995'}]}]},
  {u'Award': [{u'AwardName': u'NBA Finals Most Valuable Player',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KFMVP',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(441781200000-0500)/',
       u'Year': u'1984-85'},
      {u'SortOrder': u'/Date(18000000-0500)/', u'Year': u'1970-71'}]}]},
  {u'Award': [{u'AwardName': u'NBA Most Valuable Player',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIMVP',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(284014800000-0500)/',
       u'Year': u'1979-80'},
      {u'SortOrder': u'/Date(189320400000-0500)/', u'Year': u'1976-77'},
      {u'SortOrder': u'/Date(157784400000-0500)/', u'Year': u'1975-76'},
      {u'SortOrder': u'/Date(94712400000-0500)/', u'Year': u'1973-74'},
      {u'SortOrder': u'/Date(31554000000-0500)/', u'Year': u'1971-72'},
      {u'SortOrder': u'/Date(18000000-0500)/', u'Year': u'1970-71'}]}]},
  {u'Award': [{u'AwardName': u'NBA Player of the Month',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIPMO',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(446965200000-0500)/',
       u'Year': u'Mar-1984'},
      {u'SortOrder': u'/Date(312872400000-0500)/', u'Year': u'Dec-1979'}]}]},
  {u'Award': [{u'AwardName': u'NBA Player of the Week',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIPWK',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(480484800000-0400)/',
       u'Year': u'03/24/1985'},
      {u'SortOrder': u'/Date(450244800000-0400)/', u'Year': u'04/08/1984'},
      {u'SortOrder': u'/Date(445410000000-0500)/', u'Year': u'02/12/1984'},
      {u'SortOrder': u'/Date(383720400000-0500)/', u'Year': u'02/28/1982'},
      {u'SortOrder': u'/Date(346222800000-0500)/', u'Year': u'12/21/1980'},
      {u'SortOrder': u'/Date(319611600000-0500)/', u'Year': u'02/17/1980'},
      {u'SortOrder': u'/Date(313563600000-0500)/', u'Year': u'12/09/1979'}]}]},
  {u'Award': [{u'AwardName': u'NBA Rookie of the Year',
     u'SubType1': u'Kia Motors',
     u'SubType2': u'KIROY',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(-31518000000-0500)/',
       u'Year': u'1969-70'}]}]},
  {u'Award': [{u'AwardName': u'NBA Sporting News Most Valuable Player of the Year',
     u'SubType1': u'Sporting News',
     u'SubType2': u'SNMVP',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(284014800000-0500)/',
       u'Year': u'1979-80'},
      {u'SortOrder': u'/Date(189320400000-0500)/', u'Year': u'1976-77'},
      {u'SortOrder': u'/Date(157784400000-0500)/', u'Year': u'1975-76'},
      {u'SortOrder': u'/Date(94712400000-0500)/', u'Year': u'1973-74'},
      {u'SortOrder': u'/Date(31554000000-0500)/', u'Year': u'1971-72'},
      {u'SortOrder': u'/Date(18000000-0500)/', u'Year': u'1970-71'}]}]},
  {u'Award': [{u'AwardName': u'NBA Sporting News Rookie of the Year',
     u'SubType1': u'Sporting News',
     u'SubType2': u'SNROY',
     u'Team': u' '},
    {u'YearsAwarded': [{u'SortOrder': u'/Date(-31518000000-0500)/',
       u'Year': u'1969-70'}]}]}]}

The JSON schema for this view is just messed up... Not even going to bother trying to get it into a DataFrame

(More) Player Information


In [25]:
params = {
    'PlayerID': 2730 # Superman
}
r = requests.get('http://stats.nba.com/feeds/players/profile/{PlayerID}_Profile.js'.format(**params))
data = r.json(); data


Out[25]:
{u'PlayerProfile': [{u'PlayerBio': [{u'Age': 29,
     u'Birthdate': u'December 8, 1985',
     u'DraftPick': u'1',
     u'DraftRound': u'1',
     u'DraftTeam': u'ORL',
     u'DraftYear': u'2004',
     u'FirstSeason': u'2004',
     u'Height': u'6-11',
     u'LastSeason': u'2013',
     u'Person_ID': 2730,
     u'Rookie_Year': 2004,
     u'School': u'SW Atlanta Christian Academy (GA)',
     u'Season_Exp': 9,
     u'Weight': u'265'}]},
  {u'PlayerTeamSeasons': [{u'City': u'Orlando',
     u'Nickname': u'Magic',
     u'SeasonEnd': 2011,
     u'SeasonStart': 2004,
     u'TeamId': 1610612753},
    {u'City': u'Los Angeles',
     u'Nickname': u'Lakers',
     u'SeasonEnd': 2012,
     u'SeasonStart': 2012,
     u'TeamId': 1610612747},
    {u'City': u'Orlando',
     u'Nickname': u'Magic',
     u'SeasonEnd': 2012,
     u'SeasonStart': 2012,
     u'TeamId': 1610612753},
    {u'City': u'Houston',
     u'Nickname': u'Rockets',
     u'SeasonEnd': 2013,
     u'SeasonStart': 2013,
     u'TeamId': 1610612745},
    {u'City': u'Los Angeles',
     u'Nickname': u'Lakers',
     u'SeasonEnd': 2013,
     u'SeasonStart': 2013,
     u'TeamId': 1610612747}]}]}

This schema is still pretty terrible but let's get it into a DataFrame


In [36]:
DataFrame(data[u'PlayerProfile'][0][u'PlayerBio']).set_index('Person_ID')


Out[36]:
Age Birthdate DraftPick DraftRound DraftTeam DraftYear FirstSeason Height LastSeason Rookie_Year School Season_Exp Weight
Person_ID
2730 29 December 8, 1985 1 1 ORL 2004 2004 6-11 2013 2004 SW Atlanta Christian Academy (GA) 9 265

In [38]:
DataFrame(data[u'PlayerProfile'][1][u'PlayerTeamSeasons']).set_index('TeamId')


Out[38]:
City Nickname SeasonEnd SeasonStart
TeamId
1610612753 Orlando Magic 2011 2004
1610612747 Los Angeles Lakers 2012 2012
1610612753 Orlando Magic 2012 2012
1610612745 Houston Rockets 2013 2013
1610612747 Los Angeles Lakers 2013 2013

This gives more information such as height, draft pick number/round and the list of team affiliations, which could be easily used to build an affiliation network or something like that.

Play-by-Play


In [152]:
params = {
    'GameID': '0021301223',
    'StartPeriod': 0,
    'EndPeriod': 0,
}
r = requests.get('http://stats.nba.com//stats/playbyplay', params=params)

In [153]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(['GAME_ID', 'EVENTNUM']); df


Out[153]:
EVENTMSGTYPE EVENTMSGACTIONTYPE PERIOD WCTIMESTRING PCTIMESTRING HOMEDESCRIPTION NEUTRALDESCRIPTION VISITORDESCRIPTION SCORE SCOREMARGIN
GAME_ID EVENTNUM
0021301223 0 12 0 1 7:10 PM 12:00 None Start of 1st Period (7:10 PM EST) None None None
1 10 0 1 7:11 PM 12:00 Jump Ball Jefferson vs. Noah: Tip to Boozer None None None None
2 1 5 1 7:11 PM 11:38 None None Boozer 1' Layup (2 PTS) 2 - 0 -2
3 2 1 1 7:11 PM 11:22 MISS Kidd-Gilchrist 3' Jump Shot None Dunleavy BLOCK (1 BLK) None None
5 4 0 1 7:11 PM 11:19 Kidd-Gilchrist REBOUND (Off:1 Def:0) None None None None
4 1 72 1 7:11 PM 11:19 Kidd-Gilchrist 2' Putback Layup (2 PTS) None None 2 - 2 TIE
6 1 5 1 7:12 PM 10:52 None None Noah 1' Layup (2 PTS) (Dunleavy 1 AST) 4 - 2 -2
7 6 2 1 7:12 PM 10:40 None None Noah S.FOUL (P1.T1) None None
8 3 11 1 7:12 PM 10:40 MISS Jefferson Free Throw 1 of 2 None None None None
9 4 1 1 7:12 PM 10:40 BOBCATS Rebound None None None None
10 3 12 1 7:13 PM 10:40 Jefferson Free Throw 2 of 2 (1 PTS) None None 4 - 3 -1
12 6 1 1 7:13 PM 10:34 Kidd-Gilchrist P.FOUL (P1.T1) None None None None
13 2 1 1 7:13 PM 10:27 None None MISS Dunleavy 26' 3PT Jump Shot None None
14 4 0 1 7:13 PM 10:26 Walker REBOUND (Off:0 Def:1) None None None None
15 2 1 1 7:13 PM 10:17 MISS Walker 26' 3PT Jump Shot None None None None
16 4 0 1 7:13 PM 10:15 None None Noah REBOUND (Off:0 Def:1) None None
17 1 5 1 7:14 PM 10:02 None None Boozer 2' Layup (4 PTS) (Noah 1 AST) 6 - 3 -3
18 6 2 1 7:14 PM 9:41 None None Hinrich S.FOUL (P1.T2) None None
19 3 11 1 7:14 PM 9:41 Walker Free Throw 1 of 2 (1 PTS) None None 6 - 4 -2
21 3 12 1 7:15 PM 9:41 Walker Free Throw 2 of 2 (2 PTS) None None 6 - 5 -1
23 1 42 1 7:15 PM 9:28 None None Dunleavy 1' Driving Layup (2 PTS) 8 - 5 -3
24 1 5 1 7:15 PM 9:18 Henderson 3' Layup (2 PTS) (Walker 1 AST) None None 8 - 7 -1
25 6 2 1 7:15 PM 9:18 None None Boozer S.FOUL (P1.T3) None None
26 3 10 1 7:16 PM 9:18 Henderson Free Throw 1 of 1 (3 PTS) None None 8 - 8 TIE
28 2 46 1 7:16 PM 8:58 None None MISS Hinrich 12' Running Jump Shot None None
29 4 0 1 7:16 PM 8:57 Jefferson REBOUND (Off:0 Def:1) None None None None
30 1 1 1 7:16 PM 8:49 McRoberts 15' Jump Shot (2 PTS) (Walker 2 AST) None None 8 - 10 2
31 2 1 1 7:17 PM 8:32 None None MISS Dunleavy 20' Jump Shot None None
32 4 0 1 7:17 PM 8:31 McRoberts REBOUND (Off:0 Def:1) None None None None
33 2 1 1 7:17 PM 8:17 MISS McRoberts 27' 3PT Jump Shot None None None None
... ... ... ... ... ... ... ... ... ... ...
481 3 11 5 9:24 PM 1:30 None None MISS Dunleavy Free Throw 1 of 2 None None
482 4 1 5 9:24 PM 1:30 None None Bulls Rebound None None
484 3 12 5 9:24 PM 1:30 None None Dunleavy Free Throw 2 of 2 (12 PTS) 81 - 84 3
487 1 5 5 9:25 PM 1:15 Walker 1' Layup (18 PTS) None None 81 - 86 5
489 6 2 5 9:25 PM 1:15 None None Gibson S.FOUL (P3.T2) None None
490 3 10 5 9:25 PM 1:15 MISS Walker Free Throw 1 of 1 None None None None
492 4 0 5 9:25 PM 1:15 None None Noah REBOUND (Off:1 Def:12) None None
493 9 1 5 9:25 PM 1:15 None None Bulls Timeout: Regular (Reg.7 Short 1) None None
498 2 1 5 9:28 PM 1:05 McRoberts BLOCK (1 BLK) None MISS Augustin 26' 3PT Jump Shot None None
499 4 0 5 9:28 PM 1:03 Walker REBOUND (Off:0 Def:7) None None None None
500 1 42 5 9:28 PM 1:01 Walker 1' Driving Layup (20 PTS) None None 81 - 88 7
501 9 2 5 9:28 PM 1:01 None None Bulls Timeout: Short (Reg.7 Short 2) None None
503 5 1 5 9:29 PM 0:57 None None Gibson Bad Pass Turnover (P6.T11) None None
504 6 3 5 9:30 PM 0:57 None None Dunleavy L.B.FOUL (P3.PN) None None
505 18 1 5 9:30 PM 0:57 None Overturn Ruling None None None
506 3 11 5 9:32 PM 0:57 MISS Henderson Free Throw 1 of 2 None None None None
507 4 1 5 9:32 PM 0:57 BOBCATS Rebound None None None None
508 3 12 5 9:32 PM 0:57 MISS Henderson Free Throw 2 of 2 None None None None
510 4 0 5 9:32 PM 0:55 None None Dunleavy REBOUND (Off:1 Def:6) None None
511 5 1 5 9:32 PM 0:46 Jefferson STEAL (1 STL) None Noah Bad Pass Turnover (P2.T12) None None
512 6 28 5 9:32 PM 0:37 None None Augustin Personal Take Foul (P3.PN) None None
513 3 11 5 9:33 PM 0:37 Walker Free Throw 1 of 2 (21 PTS) None None 81 - 89 8
515 3 12 5 9:33 PM 0:37 Walker Free Throw 2 of 2 (22 PTS) None None 81 - 90 9
517 1 1 5 9:33 PM 0:31 None None Noah 17' Jump Shot (14 PTS) (Augustin 2 AST) 83 - 90 7
518 6 1 5 9:34 PM 0:20 None None Dunleavy P.FOUL (P4.PN) None None
519 3 11 5 9:34 PM 0:20 MISS Douglas-Roberts Free Throw 1 of 2 None None None None
520 4 1 5 9:34 PM 0:20 BOBCATS Rebound None None None None
521 3 12 5 9:34 PM 0:20 Douglas-Roberts Free Throw 2 of 2 (13 PTS) None None 83 - 91 8
523 1 1 5 9:34 PM 0:13 None None Augustin 26' 3PT Jump Shot (17 PTS) 86 - 91 5
524 13 0 5 9:35 PM 0:00 None End of 1st OT (9:35 PM EST) None 86 - 91 5

448 rows × 10 columns

Teams List

Get the list of active teams for a particular season


In [52]:
params = {
    'DateFrom': '',
    'DateTo': '',
    'GameScope': '',
    'GameSegment': '',
    'LastNGames': 0,
    'Location': '',
    'MeasureType': 'Base',
    'Month': 0,
    'OpponentTeamID': 0,
    'Outcome': '',
    'PaceAdjust': 'N',
    'PerMode': 'Totals',
    'Period': 0,
    'PlayerExperience': '',
    'PlayerPosition': '',
    'PlusMinus': 'N',
    'Rank': 'N',
    'Season': '2013-14',
    'SeasonSegment': '',
    'SeasonType': 'Regular Season',
    'StarterBench': '',
    'VsConference': '',
    'VsDivision': ''
}
r = requests.get('http://stats.nba.com/stats/leaguedashteamstats', params=params)

In [54]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('TEAM_ID'); df


Out[54]:
TEAM_NAME GP W L W_PCT MIN FGM FGA FG_PCT FG3M ... TOV STL BLK BLKA PF PFD PTS PLUS_MINUS CFID CFPARAMS
TEAM_ID
1610612737 Atlanta Hawks 82 38 44 0.463 3966.000 3061 6688 0.458 768 ... 1251 680 326 354 1577 1643 8282 -39 10 Atlanta Hawks
1610612738 Boston Celtics 82 25 57 0.305 3946.000 2996 6883 0.435 575 ... 1261 584 343 373 1743 1564 7892 -366 10 Boston Celtics
1610612751 Brooklyn Nets 82 44 38 0.537 3976.000 2931 6391 0.459 709 ... 1191 705 311 337 1777 1704 8079 -82 10 Brooklyn Nets
1610612766 Charlotte Bobcats 82 43 39 0.524 3981.000 2976 6730 0.442 516 ... 1010 499 421 415 1493 1716 7942 -18 10 Charlotte Bobcats
1610612741 Chicago Bulls 82 48 34 0.585 3986.000 2843 6577 0.432 508 ... 1223 594 424 490 1565 1713 7680 152 10 Chicago Bulls
1610612739 Cleveland Cavaliers 82 33 49 0.402 3986.000 3036 6955 0.437 584 ... 1163 579 304 461 1640 1599 8054 -270 10 Cleveland Cavaliers
1610612742 Dallas Mavericks 82 49 33 0.598 3966.000 3249 6858 0.474 721 ... 1110 704 356 288 1636 1633 8597 197 10 Dallas Mavericks
1610612743 Denver Nuggets 82 36 46 0.439 3950.985 3147 7042 0.447 702 ... 1305 615 459 459 1890 1778 8559 -176 10 Denver Nuggets
1610612765 Detroit Pistons 82 29 53 0.354 3956.000 3182 7124 0.447 507 ... 1193 687 395 403 1666 1699 8286 -300 10 Detroit Pistons
1610612744 Golden State Warriors 82 51 31 0.622 3966.000 3236 7005 0.462 774 ... 1247 642 407 342 1784 1584 8549 394 10 Golden State Warriors
1610612745 Houston Rockets 82 54 28 0.659 3966.000 3118 6603 0.472 779 ... 1323 621 461 460 1676 1993 8829 374 10 Houston Rockets
1610612754 Indiana Pacers 82 56 26 0.683 3956.000 2949 6573 0.449 550 ... 1237 550 446 378 1675 1793 7933 361 10 Indiana Pacers
1610612746 Los Angeles Clippers 82 57 25 0.695 3951.000 3208 6761 0.474 693 ... 1136 703 397 284 1767 1919 8850 572 10 Los Angeles Clippers
1610612747 Los Angeles Lakers 82 27 55 0.329 3941.000 3139 6980 0.450 774 ... 1239 611 446 387 1627 1580 8442 -516 10 Los Angeles Lakers
1610612763 Memphis Grizzlies 82 50 32 0.610 3961.000 3122 6723 0.464 405 ... 1124 631 375 410 1568 1553 7884 129 10 Memphis Grizzlies
1610612748 Miami Heat 82 54 28 0.659 3976.000 3142 6272 0.501 665 ... 1212 732 367 256 1596 1675 8380 390 10 Miami Heat
1610612749 Milwaukee Bucks 82 15 67 0.183 3976.000 2952 6737 0.438 548 ... 1238 541 403 413 1713 1690 7829 -671 10 Milwaukee Bucks
1610612750 Minnesota Timberwolves 82 40 42 0.488 3971.000 3189 7175 0.444 600 ... 1142 718 297 457 1504 1936 8768 219 10 Minnesota Timberwolves
1610612740 New Orleans Pelicans 82 34 48 0.415 3971.000 3101 6761 0.459 486 ... 1129 647 523 504 1857 1664 8177 -222 10 New Orleans Pelicans
1610612752 New York Knicks 82 37 45 0.451 3971.000 3027 6739 0.449 759 ... 1063 631 367 277 1815 1611 8084 -65 10 New York Knicks
1610612760 Oklahoma City Thunder 82 59 23 0.720 3961.000 3194 6782 0.471 664 ... 1256 678 501 296 1858 1672 8705 520 10 Oklahoma City Thunder
1610612753 Orlando Magic 82 23 59 0.280 3991.000 3022 6784 0.445 563 ... 1222 630 350 445 1678 1500 7914 -446 10 Orlando Magic
1610612755 Philadelphia 76ers 82 19 63 0.232 3970.985 3108 7150 0.435 577 ... 1384 765 330 558 1844 1686 8155 -857 10 Philadelphia 76ers
1610612756 Phoenix Suns 82 48 34 0.585 3951.000 3172 6845 0.463 765 ... 1258 688 374 332 1798 1749 8629 216 10 Phoenix Suns
1610612757 Portland Trail Blazers 82 54 28 0.659 3971.000 3207 7134 0.450 770 ... 1125 454 387 304 1576 1698 8753 327 10 Portland Trail Blazers
1610612758 Sacramento Kings 82 28 54 0.341 3966.000 3026 6766 0.447 491 ... 1249 587 318 459 1849 1897 8241 -238 10 Sacramento Kings
1610612759 San Antonio Spurs 82 62 20 0.756 3951.000 3326 6844 0.486 698 ... 1180 604 420 379 1495 1585 8639 633 10 San Antonio Spurs
1610612761 Toronto Raptors 82 48 34 0.585 3991.000 2992 6718 0.445 713 ... 1159 577 343 352 1882 1815 8305 266 10 Toronto Raptors
1610612762 Utah Jazz 82 25 57 0.305 3956.000 2951 6652 0.444 543 ... 1200 570 366 401 1699 1673 7791 -588 10 Utah Jazz
1610612764 Washington Wizards 82 44 38 0.537 4011.000 3177 6920 0.459 647 ... 1204 668 377 320 1675 1600 8254 104 10 Washington Wizards

30 rows × 29 columns

Seems to only go as far back as 1995 though


In [70]:
params['Season'] = '1995-96'
r = requests.get('http://stats.nba.com/stats/leaguedashteamstats', params=params)
r.text


Out[70]:
u'{"resource":"leaguedashteamstats","parameters":{"MeasureType":"Base","PerMode":"Totals","PlusMinus":"N","PaceAdjust":"N","Rank":"N","LeagueID":null,"Season":"1995-96","SeasonType":"Regular Season","Outcome":null,"Location":null,"Month":0,"SeasonSegment":null,"DateFrom":null,"DateTo":null,"OpponentTeamID":0,"VsConference":null,"VsDivision":null,"GameSegment":null,"Period":0,"LastNGames":0,"GameScope":null,"PlayerExperience":null,"PlayerPosition":null,"StarterBench":null},"resultSets":[{"name":"LeagueDashTeamStats","headers":["TEAM_ID","TEAM_NAME","GP","W","L","W_PCT","MIN","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA","FT_PCT","OREB","DREB","REB","AST","TOV","STL","BLK","BLKA","PF","PFD","PTS","PLUS_MINUS","CFID","CFPARAMS"],"rowSet":[]}]}'

In [72]:
params['Season'] = '1996-97'
r = requests.get('http://stats.nba.com/stats/leaguedashteamstats', params=params)

In [74]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('TEAM_ID'); df


Out[74]:
TEAM_NAME GP W L W_PCT MIN FGM FGA FG_PCT FG3M ... TOV STL BLK BLKA PF PFD PTS PLUS_MINUS CFID CFPARAMS
TEAM_ID
1610612737 Atlanta Hawks 82 56 26 0.683 4076.438333 2812 6307 0.446 659 ... 1228 701 427 332 1506 5 7774 446 10 Atlanta Hawks
1610612738 Boston Celtics 82 15 67 0.183 4110.655000 3066 6967 0.440 467 ... 1342 811 315 557 1779 9 8248 -601 10 Boston Celtics
1610612740 Charlotte Hornets 82 54 28 0.659 4086.335000 2988 6341 0.471 591 ... 1203 597 349 335 1628 15 8108 153 10 Charlotte Hornets
1610612741 Chicago Bulls 82 69 13 0.841 4068.781667 3277 6923 0.473 523 ... 1109 717 332 286 1507 17 8458 886 10 Chicago Bulls
1610612739 Cleveland Cavaliers 82 42 40 0.512 4115.428333 2704 5972 0.453 483 ... 1188 657 315 350 1728 20 7173 151 10 Cleveland Cavaliers
1610612742 Dallas Mavericks 82 24 58 0.293 4090.830000 2812 6451 0.436 429 ... 1323 654 351 433 1678 15 7428 -522 10 Dallas Mavericks
1610612743 Denver Nuggets 82 21 61 0.256 4116.966667 2934 6687 0.439 636 ... 1359 504 487 453 1669 19 8020 -515 10 Denver Nuggets
1610612765 Detroit Pistons 82 54 28 0.659 4090.888333 2827 6095 0.464 582 ... 1042 633 283 281 1524 15 7723 430 10 Detroit Pistons
1610612744 Golden State Warriors 82 30 52 0.366 4108.676667 2996 6566 0.456 481 ... 1410 612 359 395 1660 5 8169 -388 10 Golden State Warriors
1610612745 Houston Rockets 82 57 25 0.695 4089.153333 3037 6484 0.468 671 ... 1365 688 347 365 1506 15 8248 367 10 Houston Rockets
1610612754 Indiana Pacers 82 39 43 0.476 4132.256667 2851 6254 0.456 430 ... 1338 585 394 418 1813 28 7819 80 10 Indiana Pacers
1610612746 Los Angeles Clippers 82 36 46 0.439 4123.706667 2989 6696 0.446 474 ... 1311 733 441 419 1864 10 7969 -193 10 Los Angeles Clippers
1610612747 Los Angeles Lakers 82 56 26 0.683 4121.368333 3018 6642 0.454 551 ... 1222 740 575 388 1698 9 8200 350 10 Los Angeles Lakers
1610612748 Miami Heat 82 61 21 0.744 4100.851667 2822 6235 0.453 678 ... 1306 651 439 392 1741 21 7776 450 10 Miami Heat
1610612749 Milwaukee Bucks 82 33 49 0.402 4078.358333 2967 6303 0.471 324 ... 1285 634 348 392 1773 11 7818 -155 10 Milwaukee Bucks
1610612750 Minnesota Timberwolves 82 40 42 0.488 4087.591667 2937 6435 0.456 371 ... 1243 618 557 444 1699 13 7882 -121 10 Minnesota Timberwolves
1610612751 New Jersey Nets 82 26 56 0.317 4078.453333 2994 7091 0.422 484 ... 1290 678 481 516 1736 14 7974 -374 10 New Jersey Nets
1610612752 New York Knicks 82 57 25 0.695 4125.016667 2882 6227 0.463 470 ... 1462 630 378 295 1862 14 7819 256 10 New York Knicks
1610612753 Orlando Magic 82 45 37 0.549 4087.943333 2839 6497 0.437 567 ... 1250 697 362 417 1564 9 7719 -29 10 Orlando Magic
1610612755 Philadelphia 76ers 82 22 60 0.268 4071.365000 3003 6850 0.438 433 ... 1437 683 394 494 1632 8 8215 -536 10 Philadelphia 76ers
1610612756 Phoenix Suns 82 40 42 0.488 4090.001667 3143 6705 0.469 527 ... 1180 664 322 372 1635 9 8431 54 10 Phoenix Suns
1610612757 Portland Trail Blazers 82 49 33 0.598 4111.315000 3000 6465 0.464 501 ... 1357 640 434 428 1767 15 8114 342 10 Portland Trail Blazers
1610612758 Sacramento Kings 82 34 48 0.415 4100.348333 2999 6610 0.454 414 ... 1332 588 362 429 1872 9 7906 -277 10 Sacramento Kings
1610612759 San Antonio Spurs 82 20 62 0.244 4074.166667 2826 6390 0.442 378 ... 1243 646 431 448 1628 13 7416 -646 10 San Antonio Spurs
1610612760 Seattle SuperSonics 82 57 25 0.695 4093.441667 2994 6413 0.467 559 ... 1231 904 388 423 1699 14 8272 633 10 Seattle SuperSonics
1610612761 Toronto Raptors 82 30 52 0.366 4091.786667 2897 6632 0.437 589 ... 1347 723 517 442 1801 7 7829 -256 10 Toronto Raptors
1610612762 Utah Jazz 82 64 18 0.780 4122.558333 3131 6216 0.504 334 ... 1259 748 418 373 1857 18 8454 721 10 Utah Jazz
1610612763 Vancouver Grizzlies 82 14 68 0.171 4075.805000 2819 6453 0.437 445 ... 1302 658 464 461 1641 5 7313 -839 10 Vancouver Grizzlies
1610612764 Washington Bullets 82 44 38 0.537 4100.316667 3208 6678 0.480 331 ... 1290 715 402 334 1694 16 8147 133 10 Washington Bullets

29 rows × 29 columns

Worth noting are teams such as Washington Bullets, Vancouver Grizzlies, Seattle SuperSonics, etc.

Team Game Log


In [94]:
params = {
    'TeamID': 1610612752, # New York Knicks
    'Season': '2013-14',
    'SeasonType': 'Regular Season'
}
r = requests.get('http://stats.nba.com/stats/teamgamelog', params=params)

In [95]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(['Team_ID', 'Game_ID']); df


Out[95]:
GAME_DATE MATCHUP WL MIN FGM FGA FG_PCT FG3M FG3A FG3_PCT ... OREB DREB REB AST STL BLK TOV PF PTS VIDEO_AVAILABLE
Team_ID Game_ID
1610612752 0021301226 APR 16, 2014 NYK vs. TOR W 240 37 81 0.457 8 17 0.471 ... 11 25 36 13 12 6 16 23 95 1
0021301214 APR 15, 2014 NYK @ BKN W 240 32 67 0.478 11 21 0.524 ... 8 28 36 15 11 5 16 28 109 1
0021301197 APR 13, 2014 NYK vs. CHI W 240 37 81 0.457 9 25 0.360 ... 7 29 36 16 9 5 9 25 100 1
0021301177 APR 11, 2014 NYK @ TOR W 240 35 73 0.479 6 24 0.250 ... 7 32 39 16 6 3 8 24 108 1
0021301149 APR 06, 2014 NYK @ MIA L 240 33 88 0.375 15 42 0.357 ... 15 23 38 18 10 2 10 24 91 1
0021301136 APR 04, 2014 NYK vs. WAS L 240 34 76 0.447 14 31 0.452 ... 8 26 34 23 9 1 16 14 89 1
0021301115 APR 02, 2014 NYK vs. BKN W 240 42 70 0.600 11 25 0.440 ... 9 32 41 21 11 5 15 25 110 1
0021301110 MAR 31, 2014 NYK @ UTA W 240 33 70 0.471 9 29 0.310 ... 3 35 38 18 8 6 9 18 92 1
0021301098 MAR 30, 2014 NYK @ GSW W 240 32 80 0.400 9 25 0.360 ... 10 30 40 15 5 3 9 19 89 1
0021301085 MAR 28, 2014 NYK @ PHX L 240 35 87 0.402 8 25 0.320 ... 13 24 37 14 7 2 11 24 88 1
0021301069 MAR 26, 2014 NYK @ SAC W 240 40 73 0.548 15 26 0.577 ... 7 27 34 25 3 4 14 30 107 1
0021301060 MAR 25, 2014 NYK @ LAL L 240 36 74 0.486 4 15 0.267 ... 8 24 32 23 9 4 15 16 96 1
0021301045 MAR 23, 2014 NYK vs. CLE L 240 35 77 0.455 12 27 0.444 ... 9 25 34 21 7 2 12 13 100 1
0021301023 MAR 21, 2014 NYK @ PHI W 240 34 82 0.415 7 29 0.241 ... 9 38 47 29 6 2 11 17 93 1
0021301013 MAR 19, 2014 NYK vs. IND W 240 32 82 0.390 4 17 0.235 ... 10 35 45 15 6 2 10 26 92 1
0021300981 MAR 15, 2014 NYK vs. MIL W 240 42 76 0.553 8 20 0.400 ... 13 28 41 14 3 7 11 23 115 1
0021300962 MAR 12, 2014 NYK @ BOS W 240 42 80 0.525 11 19 0.579 ... 12 35 47 20 11 7 8 21 116 1
0021300946 MAR 10, 2014 NYK vs. PHI W 240 44 81 0.543 13 32 0.406 ... 10 25 35 20 10 6 13 24 123 1
0021300928 MAR 08, 2014 NYK @ CLE W 240 38 88 0.432 14 31 0.452 ... 13 36 49 26 7 9 13 16 107 1
0021300921 MAR 07, 2014 NYK vs. UTA W 240 42 85 0.494 12 31 0.387 ... 8 27 35 24 9 7 7 19 108 1
0021300911 MAR 05, 2014 NYK @ MIN W 240 47 90 0.522 11 27 0.407 ... 12 27 39 24 11 4 12 24 118 1
0021300892 MAR 03, 2014 NYK @ DET L 240 32 83 0.386 10 28 0.357 ... 12 28 40 16 8 6 16 27 85 1
0021300883 MAR 02, 2014 NYK @ CHI L 240 35 79 0.443 5 18 0.278 ... 12 32 44 17 0 5 12 23 90 1
0021300869 FEB 28, 2014 NYK vs. GSW L 240 36 95 0.379 10 25 0.400 ... 13 37 50 14 8 4 17 24 103 1
0021300865 FEB 27, 2014 NYK @ MIA L 240 31 83 0.373 4 23 0.174 ... 14 26 40 16 7 1 13 21 82 1
0021300843 FEB 24, 2014 NYK vs. DAL L 240 40 76 0.526 14 33 0.424 ... 11 30 41 23 3 3 19 24 108 1
0021300827 FEB 22, 2014 NYK @ ATL L 240 39 89 0.438 10 28 0.357 ... 8 33 41 22 6 4 10 24 98 1
0021300816 FEB 21, 2014 NYK @ ORL L 290 45 95 0.474 15 34 0.441 ... 7 37 44 24 6 4 13 21 121 1
0021300806 FEB 19, 2014 NYK @ NOP W 240 37 83 0.446 10 21 0.476 ... 13 25 38 20 8 6 9 17 98 1
0021300796 FEB 18, 2014 NYK @ MEM L 240 35 85 0.412 6 27 0.222 ... 14 25 39 15 8 5 12 23 93 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
0021300438 DEC 28, 2013 NYK @ TOR L 240 39 80 0.488 7 21 0.333 ... 7 30 37 23 11 4 14 26 100 1
0021300430 DEC 27, 2013 NYK vs. TOR L 240 30 79 0.380 10 19 0.526 ... 13 29 42 19 11 5 16 29 83 1
0021300419 DEC 25, 2013 NYK vs. OKC L 240 38 90 0.422 6 23 0.261 ... 12 30 42 23 5 2 12 22 94 1
0021300409 DEC 23, 2013 NYK @ ORL W 240 39 86 0.453 10 21 0.476 ... 9 38 47 19 3 4 9 21 103 1
0021300392 DEC 21, 2013 NYK vs. MEM L 240 33 79 0.418 6 22 0.273 ... 6 23 29 21 12 6 7 15 87 1
0021300375 DEC 18, 2013 NYK @ MIL W 290 38 101 0.376 17 41 0.415 ... 14 37 51 26 11 6 12 31 107 1
0021300361 DEC 16, 2013 NYK vs. WAS L 240 33 79 0.418 11 30 0.367 ... 9 26 35 21 9 6 9 20 101 1
0021300345 DEC 14, 2013 NYK vs. ATL W 240 44 87 0.506 8 19 0.421 ... 15 17 32 19 14 1 11 16 111 1
0021300333 DEC 13, 2013 NYK @ BOS L 240 32 80 0.400 5 21 0.238 ... 9 29 38 20 7 1 6 19 86 1
0021300324 DEC 11, 2013 NYK vs. CHI W 240 31 76 0.408 5 19 0.263 ... 10 29 39 17 16 7 13 21 83 1
0021300310 DEC 10, 2013 NYK @ CLE L 240 40 87 0.460 10 31 0.323 ... 9 22 31 27 4 5 13 19 94 1
0021300299 DEC 08, 2013 NYK vs. BOS L 240 25 73 0.342 6 16 0.375 ... 4 22 26 13 10 3 14 18 73 1
0021300284 DEC 06, 2013 NYK vs. ORL W 240 44 83 0.530 17 34 0.500 ... 10 35 45 25 8 5 10 20 121 1
0021300277 DEC 05, 2013 NYK @ BKN W 240 44 77 0.571 16 27 0.593 ... 7 23 30 24 11 7 12 29 113 2
0021300254 DEC 01, 2013 NYK vs. NOP L 240 34 76 0.447 13 35 0.371 ... 13 29 42 23 9 9 17 23 99 1
0021300238 NOV 29, 2013 NYK @ DEN L 240 34 83 0.410 6 22 0.273 ... 8 34 42 16 6 6 10 24 95 1
0021300227 NOV 27, 2013 NYK @ LAC L 240 32 83 0.386 3 20 0.150 ... 12 32 44 20 6 6 14 27 80 1
0021300210 NOV 25, 2013 NYK @ POR L 240 38 85 0.447 6 15 0.400 ... 10 34 44 24 5 3 9 17 91 1
0021300189 NOV 23, 2013 NYK @ WAS L 240 36 82 0.439 11 29 0.379 ... 11 29 40 24 7 3 9 24 89 1
0021300163 NOV 20, 2013 NYK vs. IND L 265 37 100 0.370 8 30 0.267 ... 16 36 52 15 9 5 15 32 96 1
0021300157 NOV 19, 2013 NYK @ DET L 240 33 76 0.434 6 24 0.250 ... 10 25 35 16 9 3 13 22 86 1
0021300139 NOV 16, 2013 NYK vs. ATL L 240 34 90 0.378 10 30 0.333 ... 19 29 48 19 6 3 14 20 90 1
0021300123 NOV 14, 2013 NYK vs. HOU L 240 38 87 0.437 8 20 0.400 ... 10 26 36 20 6 5 9 28 106 1
0021300116 NOV 13, 2013 NYK @ ATL W 240 37 88 0.420 12 34 0.353 ... 8 29 37 24 11 3 3 19 95 1
0021300094 NOV 10, 2013 NYK vs. SAS L 240 31 82 0.378 6 22 0.273 ... 9 24 33 16 6 1 10 22 89 1
0021300073 NOV 08, 2013 NYK @ CHA W 240 42 90 0.467 12 26 0.462 ... 12 25 37 25 5 9 12 22 101 1
0021300054 NOV 05, 2013 NYK vs. CHA L 240 35 82 0.427 8 28 0.286 ... 11 22 33 12 11 4 14 27 97 1
0021300045 NOV 03, 2013 NYK vs. MIN L 240 40 89 0.449 9 32 0.281 ... 14 35 49 21 7 3 16 26 100 1
0021300018 OCT 31, 2013 NYK @ CHI L 240 31 86 0.360 9 24 0.375 ... 13 29 42 20 12 8 15 24 81 1
0021300008 OCT 30, 2013 NYK vs. MIL W 240 36 71 0.507 3 13 0.231 ... 6 28 34 17 12 6 22 16 90 1

82 rows × 23 columns


In [96]:
df.describe()


Out[96]:
MIN FGM FGA FG_PCT FG3M FG3A FG3_PCT FTM FTA FT_PCT OREB DREB REB AST STL BLK TOV PF PTS VIDEO_AVAILABLE
count 82.000000 82.000000 82.000000 82.00000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000 82.000000
mean 242.134146 36.914634 82.182927 0.45061 9.256098 24.853659 0.368939 15.500000 20.365854 0.759927 10.609756 29.719512 40.329268 20.012195 7.695122 4.475610 12.402439 22.134146 98.585366 1.012195
std 8.959115 4.912069 6.778922 0.05996 3.438385 5.975510 0.096960 5.471024 6.553695 0.102890 3.180791 4.740877 5.864846 4.203155 3.117806 2.294522 3.637459 4.132862 11.167580 0.110432
min 240.000000 24.000000 67.000000 0.33800 3.000000 13.000000 0.150000 4.000000 5.000000 0.400000 3.000000 17.000000 26.000000 11.000000 0.000000 1.000000 3.000000 13.000000 73.000000 1.000000
25% 240.000000 33.250000 77.250000 0.40725 6.000000 20.250000 0.290500 12.250000 16.000000 0.700000 8.250000 26.000000 36.000000 16.000000 6.000000 3.000000 10.000000 19.000000 90.000000 1.000000
50% 240.000000 37.000000 82.000000 0.44650 9.000000 25.000000 0.375000 15.000000 20.000000 0.759500 10.000000 29.000000 40.000000 20.000000 7.500000 4.000000 12.000000 22.000000 98.000000 1.000000
75% 240.000000 40.000000 87.000000 0.48675 11.000000 28.750000 0.436000 18.000000 23.000000 0.833000 13.000000 33.750000 44.000000 23.750000 10.000000 6.000000 15.000000 24.000000 106.750000 1.000000
max 290.000000 50.000000 101.000000 0.60000 17.000000 42.000000 0.593000 34.000000 40.000000 1.000000 20.000000 41.000000 55.000000 29.000000 16.000000 12.000000 23.000000 32.000000 125.000000 2.000000

Team Profile


In [105]:
params = {
    'TeamID': 1610612741, # Chicago Bulls
}
r = requests.get('http://stats.nba.com/feeds/teams/profile/{TeamID}_TeamProfile.js'.format(**params)); r.json()


Out[105]:
{u'TeamDetails': [{u'Details': [{u'Abbreviation': u'CHI',
     u'Arena': u'United Center',
     u'ArenaCapacity': u'21711',
     u'City': u'Chicago',
     u'DLeagueAffiliation': u'None',
     u'GeneralManager': u'Gar Forman',
     u'HeadCoach': u'Tom Thibodeau',
     u'Nickname': u'Bulls',
     u'Owner': u'Jerry Reinsdorf',
     u'Team_Id': 1610612741,
     u'YearActiveTill': u'present',
     u'YearFounded': 1966}]},
  {u'History': [{u'City': u'Chicago',
     u'Nickname': u'Bulls',
     u'Team_Id': 1610612741,
     u'YearActiveTill': 2012,
     u'YearFounded': 1966}]},
  {u'SocialSites': [{u'AccountType': u'Facebook',
     u'WebSite_Link': u'https://www.facebook.com/chicagobulls'},
    {u'AccountType': u'Instagram',
     u'WebSite_Link': u'http://instagram.com/chicagobulls'},
    {u'AccountType': u'Twitter',
     u'WebSite_Link': u'https://twitter.com/chicagobulls'}]},
  {u'Awards': [{u'Championships': [{u'OppositeTeam': u'Los Angeles Lakers',
       u'YearAwarded': 1991},
      {u'OppositeTeam': u'Portland Trail Blazers', u'YearAwarded': 1992},
      {u'OppositeTeam': u'Phoenix Suns', u'YearAwarded': 1993},
      {u'OppositeTeam': u'Seattle SuperSonics', u'YearAwarded': 1996},
      {u'OppositeTeam': u'Utah Jazz', u'YearAwarded': 1997},
      {u'OppositeTeam': u'Utah Jazz', u'YearAwarded': 1998}]},
    {u'ConferenceTitles': [{u'OppositeTeam': None, u'YearAwarded': 1991},
      {u'OppositeTeam': None, u'YearAwarded': 1992},
      {u'OppositeTeam': None, u'YearAwarded': 1993},
      {u'OppositeTeam': None, u'YearAwarded': 1996},
      {u'OppositeTeam': None, u'YearAwarded': 1997},
      {u'OppositeTeam': None, u'YearAwarded': 1998}]},
    {u'DivitionalTitles': [{u'OppositeTeam': None, u'YearAwarded': 1975},
      {u'OppositeTeam': None, u'YearAwarded': 1991},
      {u'OppositeTeam': None, u'YearAwarded': 1992},
      {u'OppositeTeam': None, u'YearAwarded': 1993},
      {u'OppositeTeam': None, u'YearAwarded': 1996},
      {u'OppositeTeam': None, u'YearAwarded': 1997},
      {u'OppositeTeam': None, u'YearAwarded': 1998},
      {u'OppositeTeam': None, u'YearAwarded': 2011},
      {u'OppositeTeam': None, u'YearAwarded': 2012}]}]},
  {u'HallOfFameInductees': [{u'Jersey': None,
     u'Player': u'Chet Walker',
     u'PlayerID': 78435,
     u'Position': u'F',
     u'SeasonsWithTeam': u'1970-1975',
     u'Year': 2012},
    {u'Jersey': None,
     u'Player': u'Artis Gilmore',
     u'PlayerID': 600014,
     u'Position': u'C',
     u'SeasonsWithTeam': u'1977-1982, 1988',
     u'Year': 2011},
    {u'Jersey': None,
     u'Player': u'Dennis Rodman',
     u'PlayerID': 23,
     u'Position': u'F',
     u'SeasonsWithTeam': u'1996-1998',
     u'Year': 2011},
    {u'Jersey': None,
     u'Player': u'Scottie Pippen',
     u'PlayerID': 937,
     u'Position': u'F',
     u'SeasonsWithTeam': u'1988-1998, 2004',
     u'Year': 2010},
    {u'Jersey': None,
     u'Player': u'Michael Jordan',
     u'PlayerID': 893,
     u'Position': u'G',
     u'SeasonsWithTeam': u'1985-1993, 1995-1998',
     u'Year': 2009},
    {u'Jersey': None,
     u'Player': u'George Gervin',
     u'PlayerID': 76804,
     u'Position': u'G/F',
     u'SeasonsWithTeam': u'1986',
     u'Year': 1996},
    {u'Jersey': None,
     u'Player': u'Nate Thurmond',
     u'PlayerID': 600001,
     u'Position': u'C',
     u'SeasonsWithTeam': u'1975-1976',
     u'Year': 1985}]},
  {u'RetiredMembers': [{u'Jersey': u'33',
     u'Player': u'Scottie Pippen',
     u'PlayerID': 937,
     u'Position': u'F',
     u'SeasonsWithTeam': u'1988-1998, 2004',
     u'Year': 2005},
    {u'Jersey': u' ',
     u'Player': u'Jerry Krause',
     u'PlayerID': None,
     u'Position': u'General Manager',
     u'SeasonsWithTeam': u'1985-2003',
     u'Year': 2003},
    {u'Jersey': u' ',
     u'Player': u'Phil Jackson',
     u'PlayerID': 77106,
     u'Position': u'Coach',
     u'SeasonsWithTeam': u'1988-1998',
     u'Year': 1999},
    {u'Jersey': u'10',
     u'Player': u'Bob Love',
     u'PlayerID': 77412,
     u'Position': u'F',
     u'SeasonsWithTeam': u'1969-1977',
     u'Year': 1994},
    {u'Jersey': u'23',
     u'Player': u'Michael Jordan',
     u'PlayerID': 893,
     u'Position': u'G',
     u'SeasonsWithTeam': u'1985-1993, 1995-1998',
     u'Year': 1994},
    {u'Jersey': u'4',
     u'Player': u'Jerry Sloan',
     u'PlayerID': 78173,
     u'Position': u'G',
     u'SeasonsWithTeam': u'1967-1976',
     u'Year': 1978},
    {u'Jersey': u' ',
     u'Player': u'Johny Kerr',
     u'PlayerID': None,
     u'Position': u'Coach, Business Manager, Broadcaster',
     u'SeasonsWithTeam': u'1966-2009',
     u'Year': None}]}]}

Team Roster


In [108]:
params = {
    'TeamID': 1610612745, # Houston Rockets
    'Season': '2013-14',
    'SeasonType': 'Regular Season'
}
r = requests.get('http://stats.nba.com/stats/commonteamroster', params=params)

In [113]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(['TeamID', 'PLAYER_ID']); df


Out[113]:
SEASON LeagueID PLAYER NUM POSITION HEIGHT WEIGHT BIRTH_DATE AGE EXP SCHOOL
TeamID PLAYER_ID
1610612745 203477 2013 00 Isaiah Canaan 1 G 6-0 188 MAY 02, 1991 22 R Murray State
201976 2013 00 Patrick Beverley 2 G 6-1 185 JUL 12, 1988 24 1 Arkansas
201600 2013 00 Omer Asik 3 C 7-0 255 JUL 04, 1986 26 3 Turkey
202706 2013 00 Jordan Hamilton 5 F-G 6-7 220 OCT 06, 1990 22 2 Texas
203093 2013 00 Terrence Jones 6 F 6-9 252 JAN 09, 1992 21 1 Kentucky
202391 2013 00 Jeremy Lin 7 G 6-3 200 AUG 23, 1988 24 3 Harvard
2730 2013 00 Dwight Howard 12 C-F 6-11 265 DEC 08, 1985 27 9 SW Atlanta Christian Academy (GA)
201935 2013 00 James Harden 13 G 6-5 220 AUG 26, 1989 23 4 Arizona State
201956 2013 00 Omri Casspi 18 F 6-9 225 JUN 22, 1988 25 4 Yavne, Israel
202700 2013 00 Donatas Motiejunas 20 F-C 7-0 222 SEP 20, 1990 22 1 Kaunas, Lithuania
2694 2013 00 Josh Powell 21 F 6-9 240 JAN 25, 1983 30 6 North Carolina State
202718 2013 00 Chandler Parsons 25 F 6-9 227 OCT 25, 1988 24 2 Florida
203584 2013 00 Troy Daniels 30 G 6-4 204 JUL 15, 1991 21 R Virginia Commonwealth
101128 2013 00 Francisco Garcia 32 G-F 6-7 195 DEC 31, 1980 32 8 Louisville
203496 2013 00 Robert Covington 33 F 6-9 215 DEC 14, 1990 22 R Tennessee State

We can even get all the coaching staff right down to 'Strength and Conditioning Coach'


In [122]:
data = r.json()[u'resultSets'][1]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(['TEAM_ID', 'COACH_ID']); df


Out[122]:
SEASON FIRST_NAME LAST_NAME COACH_NAME COACH_CODE IS_ASSISTANT COACH_TYPE SCHOOL SORT_SEQUENCE
TEAM_ID COACH_ID
1610612745 MCH414916 2013 Kevin McHale KevinMcHale kevin_mchale 1 Head Coach College - Minnesota 0
BIC363464 2013 J.B. Bickerstaff J.B.Bickerstaff jb_bickerstaff 2 Assistant Coach College - Minnesota 98
FIN079911 2013 Chris Finch ChrisFinch chris_finch 2 Assistant Coach College - Franklin & Marshall 99
BUC531121 2013 Greg Buckner GregBuckner greg_buckner 2 Assistant Coach College - Clemson 100
JON375806 2013 Keith Jones KeithJones keith_jones 3 Trainer College - Arkansas 102
BIL164480 2013 Jason Biles JasonBiles jason_biles 4 Assistant Trainer College - North Florida 103
ROG717320 2013 Joe Rogowski JoeRogowski joe_rogowski 5 Strength and Conditioning Coach College - DePauw 101

Team Historical Leaders


In [132]:
params = {
    'TeamID': 1610612747  , # LA Lakers
}
r = requests.get('http://stats.nba.com/feeds/teams/stats/{TeamID}_HistoricalLeaders.js'.format(**params))

In [133]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']); df


Out[133]:
TEAM_ID PTS PTS_PERSON_ID PTS_PLAYER AST AST_PERSON_ID AST_PLAYER REB REB_PERSON_ID REB_PLAYER BLK BLK_PERSON_ID BLK_PLAYER STL STL_PERSON_ID STL_PLAYER SEASON_YEAR
0 1610612747 31700 977 Kobe Bryant 10141 77142 Magic Johnson 11463 76127 Elgin Baylor 2694 76003 Kareem Abdul-Jabbar 1835 977 Kobe Bryant 2013-14

This schema is turrible.

Team Lineups


In [145]:
params = {
    'Season': '2013-14',
    'SeasonType': 'Regular Season',
    'LeagueID': '00',
    'TeamID': 1610612751, # Brooklyn Nets
    'MeasureType':'Base',
    'PerMode': 'Totals',
    'PlusMinus': 'N',
    'PaceAdjust': 'N',
    'Rank': 'N',
    'Outcome': '',
    'Location': '',
    'Month': '0',
    'SeasonSegment': '',
    'DateFrom': '',
    'DateTo': '',
    'OpponentTeamID': '0',
    'VsConference': '',
    'VsDivision': '',
    'GameSegment': '',
    'Period': '0',
    'LastNGames': '0',
    'GroupQuantity': 5,
    'GameScope': '',
    'GameID': ''
}
r = requests.get('http://stats.nba.com/stats/teamdashlineups', params=params)

In [146]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']); df


Out[146]:
GROUP_SET GROUP_VALUE TEAM_ID TEAM_ABBREVIATION TEAM_NAME GP W L W_PCT MIN ... REB AST TOV STL BLK BLKA PF PFD PTS PLUS_MINUS
0 Overall 2013-14 1610612751 BKN Brooklyn Nets 82 44 38 0.537 3976 ... 3128 1714 1191 705 311 337 1777 1704 8079 -82

1 rows × 31 columns


In [147]:
data = r.json()[u'resultSets'][1]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('GROUP_ID'); df


Out[147]:
GROUP_SET GROUP_NAME GP W L W_PCT MIN FGM FGA FG_PCT ... REB AST TOV STL BLK BLKA PF PFD PTS PLUS_MINUS
GROUP_ID
2207 - 2733 - 1718 - 203486 - 101114 Lineups Johnson,Joe - Livingston,Shaun - Pierce,Paul -... 26 18 8 0.692 284.376667 220 434 0.507 ... 199 133 83 69 20 27 107 99 590 18
708 - 2207 - 2733 - 1718 - 101114 Lineups Garnett,Kevin - Johnson,Joe - Livingston,Shaun... 13 9 4 0.692 129.441667 100 207 0.483 ... 101 60 35 28 8 14 42 48 264 44
101187 - 708 - 2207 - 2733 - 1718 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 13 10 3 0.769 121.266667 86 190 0.453 ... 97 47 35 21 13 8 51 43 218 13
101154 - 2207 - 2733 - 1718 - 101114 Lineups Blatche,Andray - Johnson,Joe - Livingston,Shau... 26 19 7 0.731 109.821667 84 174 0.483 ... 79 43 30 27 4 8 41 47 242 25
708 - 2207 - 201572 - 1718 - 101114 Lineups Garnett,Kevin - Johnson,Joe - Lopez,Brook - Pi... 10 4 6 0.400 89.685000 65 146 0.445 ... 76 44 23 13 9 6 37 37 172 -14
101154 - 1905 - 203141 - 1891 - 101114 Lineups Blatche,Andray - Kirilenko,Andrei - Teletovic,... 5 4 1 0.800 55.266667 52 94 0.553 ... 41 37 10 12 4 3 22 20 144 28
101154 - 2207 - 201572 - 1718 - 101114 Lineups Blatche,Andray - Johnson,Joe - Lopez,Brook - P... 11 5 6 0.455 53.991667 46 95 0.484 ... 62 28 22 14 5 5 26 22 128 26
101187 - 101154 - 2733 - 203141 - 201977 Lineups Anderson,Alan - Blatche,Andray - Livingston,Sh... 8 6 2 0.750 51.766667 46 90 0.511 ... 45 19 9 11 7 4 17 23 124 37
101187 - 101154 - 2207 - 2733 - 1718 Lineups Anderson,Alan - Blatche,Andray - Johnson,Joe -... 16 11 5 0.688 49.705000 37 87 0.425 ... 41 19 11 9 3 7 23 16 98 -1
101187 - 708 - 2207 - 203141 - 101114 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 5 1 4 0.200 45.100000 45 76 0.592 ... 33 35 10 13 2 3 22 17 117 38
101187 - 708 - 2207 - 201572 - 101114 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 4 2 2 0.500 41.393333 34 59 0.576 ... 32 19 12 3 2 1 21 17 92 -10
101154 - 2207 - 1718 - 201977 - 101114 Lineups Blatche,Andray - Johnson,Joe - Pierce,Paul - T... 10 6 4 0.600 40.750000 28 61 0.459 ... 29 16 14 9 2 3 14 14 79 15
101154 - 708 - 2207 - 2733 - 1718 Lineups Blatche,Andray - Garnett,Kevin - Johnson,Joe -... 4 1 3 0.250 40.016667 30 67 0.448 ... 30 23 14 4 5 1 12 12 69 -25
101154 - 2207 - 1905 - 1718 - 101114 Lineups Blatche,Andray - Johnson,Joe - Kirilenko,Andre... 9 5 4 0.556 39.066667 30 66 0.455 ... 39 15 11 6 2 5 12 19 83 23
708 - 2207 - 1905 - 1718 - 101114 Lineups Garnett,Kevin - Johnson,Joe - Kirilenko,Andrei... 7 4 3 0.571 36.980000 27 60 0.450 ... 28 14 12 5 1 5 13 21 75 -15
101187 - 101154 - 2733 - 1718 - 203486 Lineups Anderson,Alan - Blatche,Andray - Livingston,Sh... 6 3 3 0.500 34.156667 22 42 0.524 ... 22 14 15 5 1 2 20 20 71 -5
2207 - 1718 - 203486 - 201977 - 101114 Lineups Johnson,Joe - Pierce,Paul - Plumlee,Mason - Th... 9 6 3 0.667 34.116667 30 57 0.526 ... 28 14 10 8 5 2 10 14 72 4
101154 - 2207 - 1718 - 203141 - 101114 Lineups Blatche,Andray - Johnson,Joe - Pierce,Paul - T... 5 1 4 0.200 33.738333 23 61 0.377 ... 32 12 10 2 3 0 14 16 69 2
101154 - 1905 - 203141 - 201977 - 101114 Lineups Blatche,Andray - Kirilenko,Andrei - Teletovic,... 8 7 1 0.875 32.133333 22 54 0.407 ... 26 15 8 11 1 5 16 24 62 -5
101187 - 2207 - 1718 - 203486 - 101114 Lineups Anderson,Alan - Johnson,Joe - Pierce,Paul - Pl... 9 6 3 0.667 29.891667 25 49 0.510 ... 24 12 8 8 3 1 12 12 70 16
101187 - 101154 - 2501 - 2207 - 2733 Lineups Anderson,Alan - Blatche,Andray - Evans,Reggie ... 7 0 7 0.000 29.616667 19 51 0.373 ... 28 8 7 2 1 2 12 11 56 1
101187 - 708 - 2207 - 2733 - 201572 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 4 2 2 0.500 28.983333 20 43 0.465 ... 24 10 5 2 3 1 13 11 49 0
101154 - 2207 - 2733 - 201572 - 1718 Lineups Blatche,Andray - Johnson,Joe - Livingston,Shau... 8 4 4 0.500 28.933333 18 50 0.360 ... 29 7 7 3 5 4 8 14 51 0
101187 - 101154 - 2207 - 1718 - 101114 Lineups Anderson,Alan - Blatche,Andray - Johnson,Joe -... 11 6 5 0.545 28.333333 24 47 0.511 ... 17 13 6 4 2 2 16 9 64 -4
2207 - 1905 - 1718 - 203486 - 101114 Lineups Johnson,Joe - Kirilenko,Andrei - Pierce,Paul -... 5 3 2 0.600 27.916667 27 42 0.643 ... 20 20 11 8 2 2 12 13 68 -4
101187 - 708 - 2207 - 201572 - 203116 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 3 1 2 0.333 27.383333 18 47 0.383 ... 23 11 8 5 2 3 7 7 44 -9
2501 - 2207 - 2733 - 1718 - 101114 Lineups Evans,Reggie - Johnson,Joe - Livingston,Shaun ... 3 1 2 0.333 25.860000 18 38 0.474 ... 13 12 8 3 3 3 9 10 50 3
101187 - 101154 - 2207 - 2733 - 201572 Lineups Anderson,Alan - Blatche,Andray - Johnson,Joe -... 8 2 6 0.250 25.761667 20 41 0.488 ... 24 9 10 4 3 2 9 10 55 10
708 - 2207 - 1718 - 203141 - 101114 Lineups Garnett,Kevin - Johnson,Joe - Pierce,Paul - Te... 5 2 3 0.400 24.775000 19 37 0.514 ... 11 10 9 3 1 0 15 6 48 -14
101187 - 203486 - 203129 - 203116 - 203141 Lineups Anderson,Alan - Plumlee,Mason - Shengelia,Torn... 4 0 4 0.000 24.300000 18 32 0.563 ... 26 3 11 3 1 3 10 13 54 4
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
101187 - 708 - 1718 - 203486 - 203116 Lineups Anderson,Alan - Garnett,Kevin - Pierce,Paul - ... 1 0 1 0.000 4.233333 2 6 0.333 ... 5 2 3 1 2 1 2 0 6 2
101187 - 1905 - 2733 - 203486 - 101114 Lineups Anderson,Alan - Kirilenko,Andrei - Livingston,... 2 2 0 1.000 4.216667 3 4 0.750 ... 2 3 2 1 1 0 6 3 9 -1
101187 - 708 - 2207 - 203486 - 1891 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 2 1 1 0.500 4.183333 3 7 0.429 ... 3 2 1 1 0 1 2 4 8 -2
101154 - 1905 - 203486 - 203104 - 201977 Lineups Blatche,Andray - Kirilenko,Andrei - Plumlee,Ma... 1 0 1 0.000 4.183333 3 6 0.500 ... 2 1 2 1 0 2 2 3 9 -1
101187 - 101154 - 1905 - 2733 - 1891 Lineups Anderson,Alan - Blatche,Andray - Kirilenko,And... 2 1 1 0.500 4.166667 4 8 0.500 ... 3 3 0 1 0 0 3 1 12 8
708 - 1905 - 2733 - 203486 - 1891 Lineups Garnett,Kevin - Kirilenko,Andrei - Livingston,... 2 1 1 0.500 4.100000 1 4 0.250 ... 3 1 3 0 0 0 3 3 2 -4
101187 - 2733 - 203129 - 203116 - 203141 Lineups Anderson,Alan - Livingston,Shaun - Shengelia,T... 1 1 0 1.000 4.083333 1 7 0.143 ... 2 0 2 0 0 0 4 0 2 -12
708 - 1905 - 2733 - 1718 - 203141 Lineups Garnett,Kevin - Kirilenko,Andrei - Livingston,... 1 1 0 1.000 4.083333 4 7 0.571 ... 5 1 2 0 1 0 2 1 9 1
101187 - 1905 - 1718 - 203486 - 1891 Lineups Anderson,Alan - Kirilenko,Andrei - Pierce,Paul... 1 0 1 0.000 4.050000 2 6 0.333 ... 3 1 1 1 0 1 1 4 7 2
101187 - 2215 - 2733 - 1718 - 201977 Lineups Anderson,Alan - Collins,Jason - Livingston,Sha... 1 1 0 1.000 4.016667 6 6 1.000 ... 1 1 1 0 0 0 3 0 13 -1
2501 - 708 - 2207 - 1718 - 101114 Lineups Evans,Reggie - Garnett,Kevin - Johnson,Joe - P... 1 0 1 0.000 4.016667 3 4 0.750 ... 1 3 2 0 0 0 1 1 10 5
101154 - 2207 - 1905 - 2733 - 201572 Lineups Blatche,Andray - Johnson,Joe - Kirilenko,Andre... 2 1 1 0.500 4.000000 4 7 0.571 ... 2 4 1 1 0 0 2 2 11 -3
101187 - 101154 - 1905 - 1718 - 203141 Lineups Anderson,Alan - Blatche,Andray - Kirilenko,And... 1 0 1 0.000 3.983333 4 5 0.800 ... 3 1 1 0 0 1 1 3 11 6
101154 - 2207 - 1905 - 201977 - 101114 Lineups Blatche,Andray - Johnson,Joe - Kirilenko,Andre... 2 1 1 0.500 3.971667 3 6 0.500 ... 0 2 0 0 1 0 1 0 7 1
101154 - 2207 - 2733 - 203486 - 1891 Lineups Blatche,Andray - Johnson,Joe - Livingston,Shau... 1 0 1 0.000 3.966667 3 7 0.429 ... 3 2 2 0 0 0 1 2 8 -2
101187 - 2501 - 708 - 2733 - 1718 Lineups Anderson,Alan - Evans,Reggie - Garnett,Kevin -... 2 0 2 0.000 3.950000 1 6 0.167 ... 2 0 0 0 0 1 0 1 2 -10
101187 - 101154 - 201572 - 1891 - 101114 Lineups Anderson,Alan - Blatche,Andray - Lopez,Brook -... 1 0 1 0.000 3.900000 2 6 0.333 ... 4 2 2 0 0 1 3 3 6 -1
101154 - 2501 - 1905 - 2733 - 1891 Lineups Blatche,Andray - Evans,Reggie - Kirilenko,Andr... 2 1 1 0.500 3.900000 6 8 0.750 ... 3 1 1 0 0 0 4 1 12 -2
101154 - 2207 - 201572 - 1891 - 101114 Lineups Blatche,Andray - Johnson,Joe - Lopez,Brook - T... 2 1 1 0.500 3.900000 3 8 0.375 ... 6 2 2 0 1 1 1 1 6 -7
101154 - 1718 - 203486 - 1891 - 101114 Lineups Blatche,Andray - Pierce,Paul - Plumlee,Mason -... 1 0 1 0.000 3.866667 3 8 0.375 ... 4 1 2 2 0 0 1 0 6 -4
101187 - 708 - 2207 - 203486 - 101114 Lineups Anderson,Alan - Garnett,Kevin - Johnson,Joe - ... 1 0 1 0.000 3.833333 1 5 0.200 ... 4 1 1 0 1 0 0 3 6 0
2207 - 1905 - 203486 - 201977 - 101114 Lineups Johnson,Joe - Kirilenko,Andrei - Plumlee,Mason... 2 1 1 0.500 3.816667 1 7 0.143 ... 5 0 3 0 0 1 4 2 4 -4
101154 - 2207 - 201572 - 203116 - 203141 Lineups Blatche,Andray - Johnson,Joe - Lopez,Brook - T... 2 1 1 0.500 3.778333 4 8 0.500 ... 6 3 1 0 0 0 3 1 9 2
101187 - 2501 - 2207 - 1905 - 203141 Lineups Anderson,Alan - Evans,Reggie - Johnson,Joe - K... 1 1 0 1.000 3.766667 3 7 0.429 ... 3 3 0 1 0 0 0 3 10 4
101187 - 2501 - 2733 - 1718 - 203141 Lineups Anderson,Alan - Evans,Reggie - Livingston,Shau... 2 2 0 1.000 3.766667 0 5 0.000 ... 3 0 1 0 0 1 4 0 0 -9
101187 - 101154 - 2733 - 203486 - 101114 Lineups Anderson,Alan - Blatche,Andray - Livingston,Sh... 1 0 1 0.000 3.733333 2 5 0.400 ... 1 2 1 1 2 0 1 2 8 -3
2215 - 2207 - 1905 - 1718 - 101114 Lineups Collins,Jason - Johnson,Joe - Kirilenko,Andrei... 2 2 0 1.000 3.706667 5 6 0.833 ... 2 2 1 3 0 0 4 0 11 4
101187 - 2215 - 1905 - 203104 - 203141 Lineups Anderson,Alan - Collins,Jason - Kirilenko,Andr... 1 1 0 1.000 3.683333 3 6 0.500 ... 0 2 1 1 0 0 2 0 7 -6
101187 - 708 - 201572 - 1718 - 101114 Lineups Anderson,Alan - Garnett,Kevin - Lopez,Brook - ... 1 1 0 1.000 3.683333 2 5 0.400 ... 3 0 0 1 0 0 0 1 5 5
101187 - 2733 - 203486 - 203141 - 101114 Lineups Anderson,Alan - Livingston,Shaun - Plumlee,Mas... 2 2 0 1.000 3.683333 3 7 0.429 ... 1 2 0 0 0 0 2 1 8 3

250 rows × 28 columns

Advanced Stats


In [148]:
params = {
    'GameID': '0021300962',
    'RangeType': 0,
    'StartPeriod': 0,
    'EndPeriod': 0,
    'StartRange': 0,
    'EndRange': 0,
}
r = requests.get('http://stats.nba.com/stats/boxscoreadvanced', params=params)

In [149]:
len(r.json()[u'resultSets'])


Out[149]:
15

In [150]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']); df


Out[150]:
GAME_DATE_EST GAME_SEQUENCE GAME_ID GAME_STATUS_ID GAME_STATUS_TEXT GAMECODE HOME_TEAM_ID VISITOR_TEAM_ID SEASON LIVE_PERIOD LIVE_PC_TIME NATL_TV_BROADCASTER_ABBREVIATION LIVE_PERIOD_TIME_BCAST WH_STATUS
0 2014-03-12T00:00:00 6 0021300962 3 Final 20140312/NYKBOS 1610612738 1610612752 2013 4 None Q4 - 1

In [151]:
data = r.json()[u'resultSets'][1]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']); df


Out[151]:
GAME_DATE_EST GAME_SEQUENCE GAME_ID TEAM_ID TEAM_ABBREVIATION TEAM_CITY_NAME TEAM_WINS_LOSSES PTS_QTR1 PTS_QTR2 PTS_QTR3 ... PTS_OT2 PTS_OT3 PTS_OT4 PTS_OT5 PTS_OT6 PTS_OT7 PTS_OT8 PTS_OT9 PTS_OT10 PTS
0 2014-03-12T00:00:00 6 0021300962 1610612738 BOS Boston 22-43 24 24 27 ... 0 0 0 0 0 0 0 0 0 92
1 2014-03-12T00:00:00 6 0021300962 1610612752 NYK New York 26-40 36 32 17 ... 0 0 0 0 0 0 0 0 0 116

2 rows × 22 columns

Game List


In [3]:
params = {
    'LeagueID': '00',
    'GameDate': '03/12/2014',
    'DayOffset': 0
}
r = requests.get('http://stats.nba.com/stats/scoreboard', params=params)

In [5]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index('GAME_ID'); df


Out[5]:
GAME_DATE_EST GAME_SEQUENCE GAME_STATUS_ID GAME_STATUS_TEXT GAMECODE HOME_TEAM_ID VISITOR_TEAM_ID SEASON LIVE_PERIOD LIVE_PC_TIME NATL_TV_BROADCASTER_ABBREVIATION LIVE_PERIOD_TIME_BCAST WH_STATUS
GAME_ID
0021300957 2014-03-12T00:00:00 1 3 Final 20140312/BKNMIA 1610612748 1610612751 2013 4 ESPN Q4 - ESPN 1
0021300958 2014-03-12T00:00:00 2 3 Final 20140312/DENORL 1610612753 1610612743 2013 4 None Q4 - 1
0021300959 2014-03-12T00:00:00 3 3 Final 20140312/SACPHI 1610612755 1610612758 2013 4 None Q4 - 1
0021300960 2014-03-12T00:00:00 4 3 Final 20140312/DETTOR 1610612761 1610612765 2013 4 None Q4 - 1
0021300961 2014-03-12T00:00:00 5 3 Final 20140312/CHAWAS 1610612764 1610612766 2013 4 None Q4 - 1
0021300962 2014-03-12T00:00:00 6 3 Final 20140312/NYKBOS 1610612738 1610612752 2013 4 None Q4 - 1
0021300963 2014-03-12T00:00:00 7 3 Final 20140312/MEMNOP 1610612740 1610612763 2013 4 None Q4 - 1
0021300964 2014-03-12T00:00:00 8 3 Final 20140312/DALUTA 1610612762 1610612742 2013 4 None Q4 - 1
0021300965 2014-03-12T00:00:00 9 3 Final 20140312/PORSAS 1610612759 1610612757 2013 4 ESPN Q4 - ESPN 1
0021300966 2014-03-12T00:00:00 10 3 Final 20140312/CLEPHX 1610612756 1610612739 2013 4 None Q4 - 1
0021300967 2014-03-12T00:00:00 11 3 Final 20140312/GSWLAC 1610612746 1610612744 2013 4 None Q4 - 1

Unknown


In [9]:
params = {
    # 'q': '03/12/2014'
}
r = requests.get('http://data.nba.com/data/5s/xml/nbacom/{season}/scores/{game_code}/boxscore.xml' \
                 .format(season='2013-14', game_code='0021300965'), params=params)
r.text


Out[9]:
u''

In [10]:
params = {
    'GameID': '0021300962',
}
r = requests.get('http://stats.nba.com/stats/playertrackingboxscore', params=params)
r.text


Out[10]:
u'{"Message":"No HTTP resource was found that matches the request URI \'http://stats.nba.com/stats/playertrackingboxscore?GameID=0021300962\'."}'

TODO

  • There are also the following resources for each game
    • [x] playbyplay : /stats/playbyplay
    • [x] boxscoreAdvanced : /stats/boxscoreadvanced
    • [ ] boxscoreMisc: /stats/boxscoremisc
    • [ ] boxscoreScoring: /stats/boxscorescoring
    • [ ] boxscoreUsage: /stats/boxscoreusage
    • [ ] boxscoreFourFactors: /stats/boxscorefourfactors
  • Organize the above by views specific to players, games and teams respectively
  • Find the view for player tracking
  • Find the view for game list

In [3]:
data = r.json()[u'resultSets'][0]
df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(None); df


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-e47a1d704438> in <module>()
      1 data = r.json()[u'resultSets'][0]
----> 2 df = DataFrame(data[u'rowSet'], columns=data[u'headers']).set_index(None); df

/Users/tiao/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in set_index(self, keys, drop, append, inplace, verify_integrity)
   2262                 names.append(None)
   2263             else:
-> 2264                 level = frame[col].values
   2265                 names.append(col)
   2266                 if drop:

/Users/tiao/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in __getitem__(self, key)
   1682             return self._getitem_multilevel(key)
   1683         else:
-> 1684             return self._getitem_column(key)
   1685 
   1686     def _getitem_column(self, key):

/Users/tiao/anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in _getitem_column(self, key)
   1689         # get column
   1690         if self.columns.is_unique:
-> 1691             return self._get_item_cache(key)
   1692 
   1693         # duplicate columns & possible reduce dimensionaility

/Users/tiao/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in _get_item_cache(self, item)
   1050         res = cache.get(item)
   1051         if res is None:
-> 1052             values = self._data.get(item)
   1053             res = self._box_item_values(item, values)
   1054             cache[item] = res

/Users/tiao/anaconda/lib/python2.7/site-packages/pandas/core/internals.pyc in get(self, item)
   2544                         loc = indexer.item()
   2545                     else:
-> 2546                         raise ValueError("cannot label index with a null key")
   2547 
   2548             return self.iget(loc)

ValueError: cannot label index with a null key

In [ ]: