Retrieves a team's regular season game log and stats
Project description
bbref_team_game_logs
This python package scrapes Basketball Reference to return a team's regular season game log for an entire NBA season.
Installing this package
pip install bbref-team-game-logs
API
get_team_game_logs(team,season_end_year)
Parameters:
- team : abbreviation for NBA team i.e ('PHO','DAL','BOS')
- season_end_year: end year of an NBA season ('2005' for the 2004-2005 season)
Returns:
A pandas data frame with the following columns
['Game #' 'Date' 'H/A' 'Opponent' 'W/L' 'Team PTS' 'Opponent PTS'
'Team FG' 'Team FGA' 'Team FG%' 'Team 3P' 'Team 3PA' 'Team 3P%' 'Team FT'
'Team FTA' 'Team FT%' 'Team ORB' 'Team TRB' 'Team AST' 'Team STL'
'Team BLK' 'Team TOV' 'Team PF' 'Opponent FG' 'Opponent FGA'
'Opponent FG%' 'Opponent 3P' 'Opponent 3PA' 'Opponent 3P%' 'Opponent FT'
'Opponent FTA' 'Opponent FT%' 'Opponent ORB' 'Opponent TRB'
'Opponent AST' 'Opponent STL' 'Opponent BLK' 'Opponent TOV' 'Opponent PF']
get_team_game_logs_adv(team,season_end_year)
Parameters:
- team : abbreviation for NBA team i.e ('PHO','DAL','BOS')
- season_end_year: end year of an NBA season ('2005' for the 2004-2005 season)
Returns:
A pandas data frame with the following columns
['Game #' 'Date' 'H/A' 'Opponent' 'W/L' 'Team PTS' 'Opponent PTS' 'ORtg'
'DRtg' 'Pace' 'FTr' '3PAr' 'TS%' 'TRB%' 'AST%' 'STL%' 'BLK%'
'Offensive eFG%' 'Offensive TOV%' 'Offensive ORB%' 'Offensive FT/FGA'
'Defensive eFG%' 'Defensive TOV%' 'Defensive DRB%' 'Defensive FT/FGA']
Example
from bbref_team_game_logs import get_team_game_logs, get_team_game_logs_adv
team = 'PHO'
year = '2005'
df = get_team_game_logs(team,year)
df_adv = get_team_game_logs_adv(team,year)
The code above should retreive the data from the following pages here and here
Basketball Reference Team Abbreviations
These are BBREF's abbreviation for NBA teams. Use this link here to figure out what years they have been active
ATLANTA HAWKS : ATL
ST. LOUIS HAWKS : SLH
MILWAUKEE HAWKS : MIL
TRI-CITIES BLACKHAWKS : TCB
BOSTON CELTICS : BOS
BROOKLYN NETS : BRK
NEW JERSEY NETS : NJN
CHICAGO BULLS : CHI
CHARLOTTE HORNETS : CHO
CHARLOTTE BOBCATS : CHA
CLEVELAND CAVALIERS : CLE
DALLAS MAVERICKS : DAL
DENVER NUGGETS : DEN
DETROIT PISTONS : DET
FORT WAYNE PISTONS : FWP
GOLDEN STATE WARRIORS : GSW
SAN FRANCISCO WARRIORS : SFW
PHILADELPHIA WARRIORS : PHI
HOUSTON ROCKETS : HOU
INDIANA PACERS : IND
LOS ANGELES CLIPPERS : LAC
SAN DIEGO CLIPPERS : SDC
BUFFALO BRAVES : BUF
LOS ANGELES LAKERS : LAL
MINNEAPOLIS LAKERS : MIN
MEMPHIS GRIZZLIES : MEM
VANCOUVER GRIZZLIES : VAN
MIAMI HEAT : MIA
MILWAUKEE BUCKS : MIL
MINNESOTA TIMBERWOLVES : MIN
NEW ORLEANS PELICANS : NOP
NEW ORLEANS/OKLAHOMA CITY HORNETS : NOK
NEW ORLEANS HORNETS : NOH
NEW YORK KNICKS : NYK
OKLAHOMA CITY THUNDER : OKC
SEATTLE SUPERSONICS : SEA
ORLANDO MAGIC : ORL
PHILADELPHIA 76ERS : PHI
SYRACUSE NATIONALS : SYR
PHOENIX SUNS : PHO
PORTLAND TRAIL BLAZERS : POR
SACRAMENTO KINGS : SAC
KANSAS CITY KINGS : KCK
KANSAS CITY-OMAHA KINGS : KCK
CINCINNATI ROYALS : CIN
ROCHESTER ROYALS : ROR
SAN ANTONIO SPURS : SAS
TORONTO RAPTORS : TOR
UTAH JAZZ : UTA
NEW ORLEANS JAZZ : NOJ
WASHINGTON WIZARDS : WAS
WASHINGTON BULLETS : WAS
CAPITAL BULLETS : CAP
BALTIMORE BULLETS : BAL
CHICAGO ZEPHYRS : CHI
CHICAGO PACKERS : CHI
ANDERSON PACKERS : AND
CHICAGO STAGS : CHI
INDIANAPOLIS OLYMPIANS : IND
SHEBOYGAN RED SKINS : SRS
ST. LOUIS BOMBERS : SLB
WASHINGTON CAPITOLS : WAS
WATERLOO HAWKS : WAT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bbref_team_game_logs-1.0.3.tar.gz
.
File metadata
- Download URL: bbref_team_game_logs-1.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.3.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c89cf017e83f1bc2383ade122293a612749aef869fe3289aa4a211370bf4b32 |
|
MD5 | e7d01adc02328a46ce4fb2efe862105b |
|
BLAKE2b-256 | f84d80a648b2b9b0576284c7f826b884702af210d8659234865fc9f6ede6df6c |
File details
Details for the file bbref_team_game_logs-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: bbref_team_game_logs-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.3.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41798fc4bea98fee3da3e713f59d71ac19c73462706b0b74dde087e3cdd1711b |
|
MD5 | 9dec9e389a358296cdd27065c83e5383 |
|
BLAKE2b-256 | 05b85bbf6f96da791b6911ad828fdc1f422aa36f55c51665315a78637e90b9a0 |