Open tableaukun opened 5 years ago
Here's the list of all the teams: https://www.basketball-reference.com/teams/
Need to investigate if all the teams are supported or not.
I added the ones I could find into data.py (see below). Unfortunately that page doesn't cleanly list all franchise abbreviations, so I used another site that had most of them listed correctly. Including duplicates for different spellings did not adversely affect results (like UTH vs UTA for the Jazz). I'm sure some franchises are missing, but these worked for pulling data all the way back to 1950 without NULL being returned for team.
class Location(Enum):
HOME = "HOME"
AWAY = "AWAY"
class Outcome(Enum):
WIN = "WIN"
LOSS = "LOSS"
class Team(Enum):
ANDERSON_PACKERS = "ANDERSON PACKERS"
ATLANTA_HAWKS = "ATLANTA HAWKS"
BALTIMORE_BULLETS = "BALTIMORE BULLETS"
BOSTON_CELTICS = "BOSTON CELTICS"
BROOKLYN_NETS = "BROOKLYN NETS"
BUFFALO_BRAVES = "BUFFALO BRAVES"
CAPITAL_BULLETS = "CAPITAL BULLETS"
CHARLOTTE_BOBCATS = "CHARLOTTE BOBCATS"
CHARLOTTE_HORNETS = "CHARLOTTE HORNETS"
CHICAGO_BULLS = "CHICAGO BULLS"
CHICAGO_PACKERS = "CHICAGO PACKERS"
CHICAGO_STAGS = "CHICAGO STAGS"
CHICAGO_ZEPHYRS = "CHICAGO ZEPHYRS"
CINCINNATI_ROYALS = "CINCINNATI ROYALS"
CLEVELAND_CAVALIERS = "CLEVELAND CAVALIERS"
DALLAS_MAVERICKS = "DALLAS MAVERICKS"
DENVER_NUGGETS = "DENVER NUGGETS"
DETROIT_PISTONS = "DETROIT PISTONS"
DALLAS_CHAPARRALS = "DALLAS CHAPARRALS"
FORT_WAYNE_PISTONS = "FORT WAYNE PISTONS"
GOLDEN_STATE_WARRIORS = "GOLDEN STATE WARRIORS"
HOUSTON_ROCKETS = "HOUSTON ROCKETS"
INDIANA_PACERS = "INDIANA PACERS"
INDIANAPOLIS_OLYMPIANS = "INDIANAPOLIS OLYMPIANS"
KANSAS_CITY_KINGS = "KANSAS CITY KINGS"
KANSAS_CITYOMAHA_KINGS = "KANSAS CITYOMAHA KINGS"
LOS_ANGELES_CLIPPERS = "LOS ANGELES CLIPPERS"
LOS_ANGELES_LAKERS = "LOS ANGELES LAKERS"
MEMPHIS_GRIZZLIES = "MEMPHIS GRIZZLIES"
MIAMI_HEAT = "MIAMI HEAT"
MILWAUKEE_BUCKS = "MILWAUKEE BUCKS"
MINNESOTA_TIMBERWOLVES = "MINNESOTA TIMBERWOLVES"
MINNEAPOLIS_LAKERS = "MINNEAPOLIS LAKERS"
MILWAUKEE_HAWKS = "MILWAUKEE HAWKS"
NEW_JERSEY_NETS = "NEW JERSEY NETS"
NEW_ORLEANS_HORNETS = "NEW ORLEANS HORNETS"
NEW_ORLEANS_JAZZ = "NEW ORLEANS JAZZ"
NEW_ORLEANS_OKLAHOMA_CITY_HORNETS = "NEW ORLEANS OKLAHOMA CITY HORNETS"
NEW_ORLEANS_PELICANS = "NEW ORLEANS PELICANS"
NEW_YORK_KNICKS = "NEW YORK KNICKS"
NEW_YORK_NETS = "NEW YORK NETS"
OKLAHOMA_CITY_THUNDER = "OKLAHOMA CITY THUNDER"
ORLANDO_MAGIC = "ORLANDO MAGIC"
PHILADELPHIA_76ERS = "PHILADELPHIA 76ERS"
PHOENIX_SUNS = "PHOENIX SUNS"
PHILADELPHIA_WARRIORS = "PHILADELPHIA WARRIORS"
PORTLAND_TRAILBLAZERS = "PORTLAND TRAILBLAZERS"
ROCHESTER_ROYALS = "ROCHESTER ROYALS"
SACRAMENTO_KINGS = "SACRAMENTO KINGS"
SAN_ANTONIO_SPURS = "SAN ANTONIO SPURS"
SAN_DIEGO_CLIPPERS = "SAN DIEGO CLIPPERS"
SAN_DIEGO_ROCKETS = "SAN DIEGO ROCKETS"
SEATTLE_SUPERSONICS = "SEATTLE SUPERSONICS"
SAN_FRANCISCO_WARRIORS = "SAN FRANCISCO WARRIORS"
SHEBOYGAN_REDSKINS = "SHEBOYGAN REDSKINS"
ST_LOUIS_BOMBERS = "ST LOUIS BOMBERS"
ST_LOUIS_HAWKS = "ST LOUIS HAWKS"
SYRACUSE_NATIONALS = "SYRACUSE NATIONALS"
TORONTO_RAPTORS = "TORONTO RAPTORS"
TRICITIES_BLACKHAWKS = "TRICITIES BLACKHAWKS"
UTAH_JAZZ = "UTAH JAZZ"
VANCOUVER_GRIZZLIES = "VANCOUVER GRIZZLIES"
WASHINGTON_WIZARDS = "WASHINGTON WIZARDS"
WATERLOO_HAWKS = "WATERLOO HAWKS"
WASHINGTON_BULLETS = "WASHINGTON BULLETS"
WASHINGTON_CAPITALS = "WASHINGTON CAPITALS"
TOTAL = "TOTAL"
class OutputType(Enum):
JSON = "JSON"
CSV = "CSV"
class OutputWriteOption(Enum):
WRITE = "w"
CREATE_AND_WRITE = "w+"
APPEND = "a"
APPEND_AND_WRITE = "a+"
class Position(Enum):
POINT_GUARD = "POINT GUARD"
SHOOTING_GUARD = "SHOOTING GUARD"
SMALL_FORWARD = "SMALL FORWARD"
POWER_FORWARD = "POWER FORWARD"
CENTER = "CENTER"
FORWARD = "FORWARD"
GUARD = "GUARD"
class PeriodType(Enum):
QUARTER = "QUARTER"
OVERTIME = "OVERTIME"
TEAM_ABBREVIATIONS_TO_TEAM = {
'AND': Team.ANDERSON_PACKERS,
'ATL': Team.ATLANTA_HAWKS,
'BAL': Team.BALTIMORE_BULLETS,
'BLB': Team.BALTIMORE_BULLETS,
'BOS': Team.BOSTON_CELTICS,
'BRK': Team.BROOKLYN_NETS,
'BUF': Team.BUFFALO_BRAVES,
'CAP': Team.CAPITAL_BULLETS,
'CHA': Team.CHARLOTTE_BOBCATS,
'CHH': Team.CHARLOTTE_HORNETS,
'CHO': Team.CHARLOTTE_HORNETS,
'CHI': Team.CHICAGO_BULLS,
'CHP': Team.CHICAGO_PACKERS,
'CHS': Team.CHICAGO_STAGS,
'CHZ': Team.CHICAGO_ZEPHYRS,
'CIN': Team.CINCINNATI_ROYALS,
'CLE': Team.CLEVELAND_CAVALIERS,
'DAL': Team.DALLAS_MAVERICKS,
'DEN': Team.DENVER_NUGGETS,
'DNN': Team.DENVER_NUGGETS,
'DET': Team.DETROIT_PISTONS,
'DLC': Team.DALLAS_CHAPARRALS,
'DNV': Team.DENVER_NUGGETS,
'FTW': Team.FORT_WAYNE_PISTONS,
'GSW': Team.GOLDEN_STATE_WARRIORS,
'HOU': Team.HOUSTON_ROCKETS,
'IND': Team.INDIANA_PACERS,
'INO': Team.INDIANAPOLIS_OLYMPIANS,
'KCK': Team.KANSAS_CITY_KINGS,
'KCO': Team.KANSAS_CITYOMAHA_KINGS,
'LAC': Team.LOS_ANGELES_CLIPPERS,
'LAL': Team.LOS_ANGELES_LAKERS,
'MEM': Team.MEMPHIS_GRIZZLIES,
'MIA': Team.MIAMI_HEAT,
'MIL': Team.MILWAUKEE_BUCKS,
'MIN': Team.MINNESOTA_TIMBERWOLVES,
'MLH': Team.MILWAUKEE_HAWKS,
'MNL': Team.MINNEAPOLIS_LAKERS,
'MPL': Team.MINNEAPOLIS_LAKERS,
'NJN': Team.NEW_JERSEY_NETS,
'NOH': Team.NEW_ORLEANS_HORNETS,
'NOJ': Team.NEW_ORLEANS_JAZZ,
'NOK': Team.NEW_ORLEANS_OKLAHOMA_CITY_HORNETS,
'NOP': Team.NEW_ORLEANS_PELICANS,
'NYK': Team.NEW_YORK_KNICKS,
'NYN': Team.NEW_YORK_NETS,
'OKC': Team.OKLAHOMA_CITY_THUNDER,
'ORL': Team.ORLANDO_MAGIC,
'PHI': Team.PHILADELPHIA_76ERS,
'PHO': Team.PHOENIX_SUNS,
'PHW': Team.PHILADELPHIA_WARRIORS,
'POR': Team.PORTLAND_TRAILBLAZERS,
'ROC': Team.ROCHESTER_ROYALS,
'SAC': Team.SACRAMENTO_KINGS,
'SAS': Team.SAN_ANTONIO_SPURS,
'SDC': Team.SAN_DIEGO_CLIPPERS,
'SDR': Team.SAN_DIEGO_ROCKETS,
'SEA': Team.SEATTLE_SUPERSONICS,
'SFW': Team.SAN_FRANCISCO_WARRIORS,
'SHE': Team.SHEBOYGAN_REDSKINS,
'SLB': Team.ST_LOUIS_BOMBERS,
'STB': Team.ST_LOUIS_BOMBERS,
'STL': Team.ST_LOUIS_HAWKS,
'SYR': Team.SYRACUSE_NATIONALS,
'TOR': Team.TORONTO_RAPTORS,
'TRI': Team.TRICITIES_BLACKHAWKS,
'UTH': Team.UTAH_JAZZ,
'UTA': Team.UTAH_JAZZ,
'VAN': Team.VANCOUVER_GRIZZLIES,
'WAS': Team.WASHINGTON_WIZARDS,
'WAT': Team.WATERLOO_HAWKS,
'WSB': Team.WASHINGTON_BULLETS,
'WSC': Team.WASHINGTON_CAPITALS,
'TOT': Team.TOTAL,
}
TEAM_TO_TEAM_ABBREVIATION = {v: k for k, v in TEAM_ABBREVIATIONS_TO_TEAM.items()}
TEAM_TO_TEAM_ABBREVIATION[Team.CHARLOTTE_HORNETS] = "CHO"
TEAM_NAME_TO_TEAM = {
"ANDERSON PACKERS": Team.ANDERSON_PACKERS,
"ATLANTA HAWKS": Team.ATLANTA_HAWKS,
"BALTIMORE BULLETS": Team.BALTIMORE_BULLETS,
"BOSTON CELTICS": Team.BOSTON_CELTICS,
"BROOKLYN NETS": Team.BROOKLYN_NETS,
"BUFFALO BRAVES": Team.BUFFALO_BRAVES,
"CAPITAL BULLETS": Team.CAPITAL_BULLETS,
"CHARLOTTE BOBCATS": Team.CHARLOTTE_BOBCATS,
"CHARLOTTE HORNETS": Team.CHARLOTTE_HORNETS,
"CHICAGO BULLS": Team.CHICAGO_BULLS,
"CHICAGO PACKERS": Team.CHICAGO_PACKERS,
"CHICAGO STAGS": Team.CHICAGO_STAGS,
"CHICAGO ZEPHYRS": Team.CHICAGO_ZEPHYRS,
"CINCINNATI ROYALS": Team.CINCINNATI_ROYALS,
"CLEVELAND CAVALIERS": Team.CLEVELAND_CAVALIERS,
"DALLAS MAVERICKS": Team.DALLAS_MAVERICKS,
"DENVER NUGGETS": Team.DENVER_NUGGETS,
"DETROIT PISTONS": Team.DETROIT_PISTONS,
"DALLAS CHAPARRALS": Team.DALLAS_CHAPARRALS,
"FORT WAYNE PISTONS": Team.FORT_WAYNE_PISTONS,
"GOLDEN STATE WARRIORS": Team.GOLDEN_STATE_WARRIORS,
"HOUSTON ROCKETS": Team.HOUSTON_ROCKETS,
"INDIANA PACERS": Team.INDIANA_PACERS,
"INDIANAPOLIS OLYMPIANS": Team.INDIANAPOLIS_OLYMPIANS,
"KANSAS CITY KINGS": Team.KANSAS_CITY_KINGS,
"KANSAS CITYOMAHA KINGS": Team.KANSAS_CITYOMAHA_KINGS,
"LOS ANGELES CLIPPERS": Team.LOS_ANGELES_CLIPPERS,
"LOS ANGELES LAKERS": Team.LOS_ANGELES_LAKERS,
"MEMPHIS GRIZZLIES": Team.MEMPHIS_GRIZZLIES,
"MIAMI HEAT": Team.MIAMI_HEAT,
"MILWAUKEE BUCKS": Team.MILWAUKEE_BUCKS,
"MINNESOTA TIMBERWOLVES": Team.MINNESOTA_TIMBERWOLVES,
"MILWAUKEE HAWKS": Team.MILWAUKEE_HAWKS,
"MINNEAPOLIS LAKERS": Team.MINNEAPOLIS_LAKERS,
"NEW JERSEY NETS": Team.NEW_JERSEY_NETS,
"NEW ORLEANS HORNETS": Team.NEW_ORLEANS_HORNETS,
"NEW ORLEANS JAZZ": Team.NEW_ORLEANS_JAZZ,
"NEW ORLEANS OKLAHOMA CITY HORNETS": Team.NEW_ORLEANS_OKLAHOMA_CITY_HORNETS,
"NEW ORLEANS PELICANS": Team.NEW_ORLEANS_PELICANS,
"NEW YORK KNICKS": Team.NEW_YORK_KNICKS,
"NEW YORK NETS": Team.NEW_YORK_NETS,
"OKLAHOMA CITY THUNDER": Team.OKLAHOMA_CITY_THUNDER,
"ORLANDO MAGIC": Team.ORLANDO_MAGIC,
"PHILADELPHIA 76ERS": Team.PHILADELPHIA_76ERS,
"PHOENIX SUNS": Team.PHOENIX_SUNS,
"PHILADELPHIA WARRIORS": Team.PHILADELPHIA_WARRIORS,
"PORTLAND TRAILBLAZERS": Team.PORTLAND_TRAILBLAZERS,
"ROCHESTER ROYALS": Team.ROCHESTER_ROYALS,
"SACRAMENTO KINGS": Team.SACRAMENTO_KINGS,
"SAN ANTONIO SPURS": Team.SAN_ANTONIO_SPURS,
"SAN DIEGO CLIPPERS": Team.SAN_DIEGO_CLIPPERS,
"SAN DIEGO ROCKETS": Team.SAN_DIEGO_ROCKETS,
"SEATTLE SUPERSONICS": Team.SEATTLE_SUPERSONICS,
"SAN FRANCISCO WARRIORS": Team.SAN_FRANCISCO_WARRIORS,
"SHEBOYGAN REDSKINS": Team.SHEBOYGAN_REDSKINS,
"ST LOUIS BOMBERS": Team.ST_LOUIS_BOMBERS,
"ST LOUIS HAWKS": Team.ST_LOUIS_HAWKS,
"SYRACUSE NATIONALS": Team.SYRACUSE_NATIONALS,
"TORONTO RAPTORS": Team.TORONTO_RAPTORS,
"TRICITIES BLACKHAWKS": Team.TRICITIES_BLACKHAWKS,
"UTAH JAZZ": Team.UTAH_JAZZ,
"VANCOUVER GRIZZLIES": Team.VANCOUVER_GRIZZLIES,
"WASHINGTON WIZARDS": Team.WASHINGTON_WIZARDS,
"WATERLOO HAWKS": Team.WATERLOO_HAWKS,
"WASHINGTON BULLETS": Team.WASHINGTON_BULLETS,
"WASHINGTON CAPITALS": Team.WASHINGTON_CAPITALS,
"TOTAL": Team.TOTAL
}
POSITION_ABBREVIATIONS_TO_POSITION = {
"PG": Position.POINT_GUARD,
"SG": Position.SHOOTING_GUARD,
"SF": Position.SMALL_FORWARD,
"PF": Position.POWER_FORWARD,
"C": Position.CENTER,
"F": Position.FORWARD,
"G": Position.GUARD,
}```
When pulling advanced stats from the beginning of time on BR (1950), a lot of the results come back with None for team. I did a quick test and added the Minneapolis Lakers (MNL) to data.py and was able to properly populate the team where None had been previously.