from IPython.display import Image
Image("Find-game-ID-notes.png")

"""
Explanation: *Using the 'game' component of the py-Goldsberry package to bring data from Stats.nba.com into python (pandas) dataframes*
Find the game you want by looking at the stats.nba.com website
End of explanation
"""


import pandas as pd
import goldsberry

pd.set_option("display.max_columns", 20)

gid = '0021500550'
#gid is a string, not an integer

"""
Explanation: From the stats.nba.website I look over games that have already happened. I mouse over the boxscore, and can know that the Hornets-Clippers match from Jan 09, 2016 has gameID '0021500550' by looking at the value of the boxscore link (bottom left green)
Within the 'game' method, there are many data representations (classes) one can be interested in, each of wich has their own functions
play_by_play
- plays
boxscore_summary
- game_summary
- other_stats
- officials
- inactive_players
- game_info
- line_score
- last_meeting
- season_series
boxscore_traditional
- player_stats
- team_stats
boxscore_advanced
- player_stats
- team_stats
boxscore_misc
- player_stats
- team_stats
boxscore_fourfactors
- player_stats
- team_stats
boxscore_usage
- player_stats
- team_stats
boxscore_tracking
- player_stats
- team_stats
One accessed the bits from the game they are interested in as follows: goldsberry.game.class(GID).function()
End of explanation
"""


df = pd.DataFrame(goldsberry.game.play_by_play(gid).plays())
df

"""
Explanation: Play_by_Play
End of explanation
"""


df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).game_summary())
df     

df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).other_stats())
df     

df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).officials())
df

df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).game_info())
df

df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).last_meeting())
df

df = pd.DataFrame(goldsberry.game.boxscore_summary(gid).season_series())
df

"""
Explanation: boxscore_summary
End of explanation
"""


df = pd.DataFrame(goldsberry.game.boxscore_traditional(gid).player_stats())
df

df = pd.DataFrame(goldsberry.game.boxscore_traditional(gid).team_stats())
df

"""
Explanation: boxscore_traditional
End of explanation
"""


df = pd.DataFrame(goldsberry.game.boxscore_advanced(gid).player_stats())
df

df = pd.DataFrame(goldsberry.game.boxscore_advanced(gid).team_stats())
df

"""
Explanation: boxscore_advanced
End of explanation
"""


