import pandas as pd
data_types = {
"TEAM_ID":"int64",
"team_id":"int64",
"FGA":"int64",
"FGM":"int64",
"FG_PCT":"float64",
"FG3M":"int64",
"FG3A":"int64",
"FG3_PCT":"float64",
"FTM":"int64",
"FTA":"int64",
"FT_PCT":"float64",
"OREB":"int64",
"DREB":"int64",
"REB":"int64",
"AST":"int64",
"TOV":"int64",
"STL":"int64",
"BLK":"int64",
"BLKA":"int64",
"PFA":"int64",
"PFD":"int64",
"PTS":"int64",
"PLUS_MINUS":"int64"
}
regular_season_box_scores_1 = pd.read_csv('regular_season_box_scores_2010_2024_part_1 (1).csv',dtype=data_types,parse_dates=["game_date"])
regular_season_box_scores_2 = pd.read_csv('regular_season_box_scores_2010_2024_part_2 (1).csv',dtype=data_types,parse_dates=["game_date"])
regular_season_box_scores_3 = pd.read_csv('regular_season_box_scores_2010_2024_part_3 (1).csv',dtype=data_types,parse_dates=["game_date"])
play_off_box_scores = pd.read_csv('play_off_box_scores_2010_2024 (1).csv',dtype=data_types,parse_dates=["game_date"])
play_off_totals = pd.read_csv('play_off_totals_2010_2024 (1).csv',dtype=data_types,parse_dates=["GAME_DATE"])
regular_season_totals = pd.read_csv('regular_season_totals_2010_2024 (1).csv',dtype=data_types,parse_dates=["GAME_DATE"])
Data Wrangling¶
Data Cleaning¶
The box score datasets for the regular seasons are merged into one and unnecessary columns are removed while most of the remaining columns are renamed for clarity. Additionally, column types are changed to more suitable types based on the variable. The minutes column was split into minutes seconds so that there were two numeric columns and teamCity and teamName were merged into one column as the team name combined with the city name is better known. Note that after cleaning the data, only the first 10000 rows of each dataframe are displayed.
#Merge all 3 dataframes of regular box scores into one
regular_season_box_scores = pd.concat([regular_season_box_scores_1,regular_season_box_scores_2,regular_season_box_scores_3])
#Remove unnecessary columns
regular_season_box_scores = regular_season_box_scores.drop(columns = ["teamSlug","jerseyNum"])
play_off_box_scores=play_off_box_scores.drop(columns=["teamSlug"])
regular_season_totals=regular_season_totals.drop(columns=["AVAILABLE_FLAG"])
play_off_totals=play_off_totals.drop(columns=["AVAILABLE_FLAG"])
#Rename columns
regular_season_box_scores = regular_season_box_scores.rename(columns={"season_year":"seasonYear","game_date":"gameDate"})
play_off_box_scores = play_off_box_scores.rename(columns={"season_year":"seasonYear","game_date":"gameDate"})
regular_season_totals = regular_season_totals.rename(columns={"SEASON_YEAR":"seasonYear","TEAM_ID":"team_ID","TEAM_ABBREVIATION":"teamAbbreviation","TEAM_NAME":"teamName","GAME_ID":"gameID",
"GAME_DATE":"gameDate","MATCHUP":"matchup","MIN":"minutes","FGA":"fieldGoalsAttempted","FGM":"fieldGoalsMade",
"FG_PCT":"fieldGoalsPercentage","FG3M":"threePointersMade","FG3A":"threePointersAttempted","FG3_PCT":"threePointersPercentage","FTM":"freeThrowsMade",
"FTA":"freeThrowsAttempted","FT_PCT":"freeThrowsPercentage","OREB":"reboundsOffensive","DREB":"reboundsDefensive","REB":"reboundsTotal",
"AST":"assists","TOV":"turnovers","STL":"steals","BLK":"blocks","BLKA":"opponentBlocks",
"PF":"foulsPersonal","PFD":"foulsPersonalDrawn","PTS":"points","PLUS_MINUS":"plusMinusPoints"})
play_off_totals = play_off_totals.rename(columns={"SEASON_YEAR":"seasonYear","TEAM_ID":"team_ID","TEAM_ABBREVIATION":"teamAbbreviation","TEAM_NAME":"teamName","GAME_ID":"gameID",
"GAME_DATE":"gameDate","MATCHUP":"matchup","MIN":"minutes","FGA":"fieldGoalsAttempted","FGM":"fieldGoalsMade",
"FG_PCT":"fieldGoalsPercentage","FG3M":"threePointersMade","FG3A":"threePointersAttempted","FG3_PCT":"threePointersPercentage",
"FTM":"freeThrowsMade","FTA":"freeThrowsAttempted","FT_PCT":"freeThrowsPercentage","OREB":"reboundsOffensive","DREB":"reboundsDefensive",
"REB":"reboundsTotal","AST":"assists","TOV":"turnovers","STL":"steals","BLK":"blocks","BLKA":"opponentBlocks",
"PF":"foulsPersonal","PFD":"foulsPersonalDrawn","PTS":"points","PLUS_MINUS":"plusMinusPoints"})
#Merge teamCity and teamName into one column
regular_season_box_scores["teamName"] = regular_season_box_scores["teamCity"] + " " + regular_season_box_scores["teamName"]
play_off_box_scores["teamName"] = play_off_box_scores["teamCity"] + " " + play_off_box_scores["teamName"]
# #Rename row values
# #Note that the Charlotte Bobcats are now the Charlotte Hornets, New Orleans Hornets are the New Orleans Pelicans, and the New Jersey Nets are the Brooklyn Nets
regular_season_box_scores["teamName"] = regular_season_box_scores["teamName"].replace(["Charlotte Bobcats","New Jersey Nets","LA Clippers", "New Orleans Hornets"],
["Charlotte Hornets","Brooklyn Nets","Los Angeles Clippers","New Orleans Pelicans"])
regular_season_totals["teamName"] = regular_season_totals["teamName"].replace(["Charlotte Bobcats","New Jersey Nets","LA Clippers", "New Orleans Hornets"],
["Charlotte Hornets","Brooklyn Nets","Los Angeles Clippers","New Orleans Pelicans"])
play_off_box_scores["teamName"] = play_off_box_scores["teamName"].replace(["Charlotte Bobcats", "New Jersey Nets","LA Clippers","New Orleans Hornets"],
["Charlotte Hornets","Brooklyn Nets","Los Angeles Clippers","New Orleans Pelicans"])
play_off_totals["teamName"] = play_off_totals["teamName"].replace(["Charlotte Bobcats", "New Jersey Nets","LA Clippers","New Orleans Hornets"],
["Charlotte Hornets","Brooklyn Nets","Los Angeles Clippers","New Orleans Pelicans"])
#Adjust gameDate column type from chr to date
regular_season_box_scores["gameDate"] = pd.to_datetime(regular_season_box_scores["gameDate"])
regular_season_totals["gameDate"] = pd.to_datetime(regular_season_totals["gameDate"])
play_off_box_scores["gameDate"] = pd.to_datetime(play_off_box_scores["gameDate"])
play_off_totals["gameDate"] = pd.to_datetime(play_off_totals["gameDate"])
#Separate minutes and seconds
regular_season_box_scores[["minutes","seconds"]] = regular_season_box_scores["minutes"].str.split(":", expand=True)
regular_season_box_scores["minutes"] = regular_season_box_scores["minutes"].fillna(0)
regular_season_box_scores["seconds"] = regular_season_box_scores["seconds"].fillna(0)
regular_season_box_scores["minutes"] = regular_season_box_scores["minutes"].astype("int64")
regular_season_box_scores["seconds"] = regular_season_box_scores["seconds"].astype("int64")
play_off_box_scores[["minutes","seconds"]] = play_off_box_scores["minutes"].str.split(":", expand=True)
play_off_box_scores["minutes"] = play_off_box_scores["minutes"].fillna(0)
play_off_box_scores["seconds"] = play_off_box_scores["seconds"].fillna(0)
play_off_box_scores["minutes"] = play_off_box_scores["minutes"].astype("int64")
play_off_box_scores["seconds"] = play_off_box_scores["seconds"].astype("int64")
#Sort in ascending order by date
regular_season_box_scores = regular_season_box_scores.sort_values(by="gameDate")
regular_season_totals = regular_season_totals.sort_values(by="gameDate")
play_off_box_scores = play_off_box_scores.sort_values(by="gameDate")
play_off_totals = play_off_totals.sort_values(by="gameDate")
#Remove rows containing inadmissible values
regular_season_box_scores = regular_season_box_scores[(regular_season_box_scores["gameDate"]<='2024-04-14') &
('2010-10-26'<=regular_season_box_scores["gameDate"]) &
(regular_season_box_scores["minutes"]>=0) &
(regular_season_box_scores["seconds"]>=0) &
(regular_season_box_scores["fieldGoalsAttempted"]>=0) &
(1>=regular_season_box_scores["fieldGoalsPercentage"]) &
(regular_season_box_scores["fieldGoalsPercentage"]>=0) &
(regular_season_box_scores["threePointersMade"]>=0) &
(regular_season_box_scores["threePointersAttempted"]>=0) &
(1>=regular_season_box_scores["threePointersPercentage"]) &
(regular_season_box_scores["threePointersPercentage"]>=0) &
(regular_season_box_scores["freeThrowsMade"]>=0) &
(regular_season_box_scores["freeThrowsAttempted"]>=0) &
(1>=regular_season_box_scores["freeThrowsPercentage"]) &
(regular_season_box_scores["freeThrowsPercentage"]>=0) &
(regular_season_box_scores["reboundsOffensive"]>=0) &
(regular_season_box_scores["reboundsDefensive"]>=0) &
(regular_season_box_scores["reboundsTotal"]==regular_season_box_scores["reboundsOffensive"]+regular_season_box_scores["reboundsDefensive"]) &
(regular_season_box_scores["assists"]>=0) &
(regular_season_box_scores["steals"]>=0) &
(regular_season_box_scores["blocks"]>=0) &
(regular_season_box_scores["turnovers"]>=0) &
(regular_season_box_scores["foulsPersonal"]>=0) &
(regular_season_box_scores["points"]>=0)]
play_off_box_scores = play_off_box_scores[(play_off_box_scores["gameDate"]<='2024-06-17') &
('2011-04-16'<=play_off_box_scores["gameDate"]) &
(play_off_box_scores["minutes"]>=0) &
(play_off_box_scores["seconds"]>=0) &
(play_off_box_scores["fieldGoalsAttempted"]>=0) &
(1>=play_off_box_scores["fieldGoalsPercentage"]) &
(play_off_box_scores["fieldGoalsPercentage"]>=0) &
(play_off_box_scores["threePointersMade"]>=0) &
(play_off_box_scores["threePointersAttempted"]>=0) &
(1>=play_off_box_scores["threePointersPercentage"]) &
(play_off_box_scores["threePointersPercentage"]>=0) &
(play_off_box_scores["freeThrowsMade"]>=0) &
(play_off_box_scores["freeThrowsAttempted"]>=0) &
(1>=play_off_box_scores["freeThrowsPercentage"]) &
(play_off_box_scores["freeThrowsPercentage"]>=0) &
(play_off_box_scores["reboundsOffensive"]>=0) &
(play_off_box_scores["reboundsDefensive"]>=0) &
(play_off_box_scores["reboundsTotal"]==play_off_box_scores["reboundsOffensive"]+play_off_box_scores["reboundsDefensive"]) &
(play_off_box_scores["assists"]>=0) &
(play_off_box_scores["steals"]>=0) &
(play_off_box_scores["blocks"]>=0) &
(play_off_box_scores["turnovers"]>=0) &
(play_off_box_scores["foulsPersonal"]>=0) &
(play_off_box_scores["points"]>=0)]
regular_season_totals = regular_season_totals[(regular_season_totals["gameDate"]<='2024-04-14') &
('2010-10-26'<=regular_season_totals["gameDate"]) &
(regular_season_totals["minutes"]>=0) &
(regular_season_totals["fieldGoalsAttempted"]>=0) &
(1>=regular_season_totals["fieldGoalsPercentage"]) &
(regular_season_totals["fieldGoalsPercentage"]>=0) &
(regular_season_totals["threePointersMade"]>=0) &
(regular_season_totals["threePointersAttempted"]>=0) &
(1>=regular_season_totals["threePointersPercentage"]) &
(regular_season_totals["threePointersPercentage"]>=0) &
(regular_season_totals["freeThrowsMade"]>=0) &
(regular_season_totals["freeThrowsAttempted"]>=0) &
(1>=regular_season_totals["freeThrowsPercentage"]) &
(regular_season_totals["freeThrowsPercentage"]>=0) &
(regular_season_totals["reboundsOffensive"]>=0) &
(regular_season_totals["reboundsDefensive"]>=0) &
(regular_season_totals["reboundsTotal"]==regular_season_totals["reboundsOffensive"]+regular_season_totals["reboundsDefensive"]) &
(regular_season_totals["assists"]>=0) &
(regular_season_totals["steals"]>=0) &
(regular_season_totals["blocks"]>=0) &
(regular_season_totals["turnovers"]>=0) &
(regular_season_totals["foulsPersonal"]>=0) &
(regular_season_totals["foulsPersonalDrawn"]>=0) &
(regular_season_totals["points"]>=0)]
play_off_totals = play_off_totals[(play_off_totals["gameDate"]<='2024-06-17') &
('2011-04-11'<=play_off_totals["gameDate"]) &
(play_off_totals["minutes"]>=0) &
(play_off_totals["fieldGoalsAttempted"]>=0) &
(1>=play_off_totals["fieldGoalsPercentage"]) &
(play_off_totals["fieldGoalsPercentage"]>=0) &
(play_off_totals["threePointersMade"]>=0) &
(play_off_totals["threePointersAttempted"]>=0) &
(1>=play_off_totals["threePointersPercentage"]) &
(play_off_totals["threePointersPercentage"]>=0) &
(play_off_totals["freeThrowsMade"]>=0) &
(play_off_totals["freeThrowsAttempted"]>=0) &
(1>=play_off_totals["freeThrowsPercentage"]) &
(play_off_totals["freeThrowsPercentage"]>=0) &
(play_off_totals["reboundsOffensive"]>=0) &
(play_off_totals["reboundsDefensive"]>=0) &
(play_off_totals["reboundsTotal"]==play_off_totals["reboundsOffensive"]+play_off_totals["reboundsDefensive"]) &
(play_off_totals["assists"]>=0) &
(play_off_totals["steals"]>=0) &
(play_off_totals["blocks"]>=0) &
(play_off_totals["turnovers"]>=0) &
(play_off_totals["foulsPersonal"]>=0) &
(play_off_totals["foulsPersonalDrawn"]>=0) &
(play_off_totals["points"]>=0)]
regular_season_box_scores
seasonYear | gameDate | gameId | matchup | teamId | teamCity | teamName | teamTricode | personId | personName | ... | reboundsDefensive | reboundsTotal | assists | steals | blocks | turnovers | foulsPersonal | points | plusMinusPoints | seconds | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
71276 | 2010-11 | 2010-10-26 | 21000001 | MIA @ BOS | 1610612748 | Miami | Miami Heat | MIA | 2544 | LeBron James | ... | 4 | 4 | 3 | 1 | 2 | 8 | 1 | 31 | 1 | 39 |
69652 | 2010-11 | 2010-10-26 | 21000001 | MIA @ BOS | 1610612748 | Miami | Miami Heat | MIA | 436 | Juwan Howard | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
28447 | 2010-11 | 2010-10-26 | 21000001 | BOS vs. MIA | 1610612738 | Boston | Boston Celtics | BOS | 708 | Kevin Garnett | ... | 8 | 10 | 3 | 3 | 0 | 7 | 5 | 10 | 7 | 13 |
48125 | 2010-11 | 2010-10-26 | 21000003 | LAL vs. HOU | 1610612747 | Los Angeles | Los Angeles Lakers | LAL | 202365 | Devin Ebanks | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
60750 | 2010-11 | 2010-10-26 | 21000002 | POR vs. PHX | 1610612757 | Portland | Portland Trail Blazers | POR | 202337 | Luke Babbitt | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
43467 | 2023-24 | 2024-04-14 | 22301195 | LAL @ NOP | 1610612747 | Los Angeles | Los Angeles Lakers | LAL | 2544 | LeBron James | ... | 9 | 11 | 17 | 5 | 1 | 4 | 0 | 28 | 19 | 41 |
140032 | 2023-24 | 2024-04-14 | 22301190 | NYK vs. CHI | 1610612752 | New York | New York Knicks | NYK | 1630173 | Precious Achiuwa | ... | 4 | 5 | 2 | 0 | 1 | 2 | 3 | 4 | -2 | 30 |
26593 | 2023-24 | 2024-04-14 | 22301191 | ORL vs. MIL | 1610612753 | Orlando | Orlando Magic | ORL | 1630175 | Cole Anthony | ... | 3 | 5 | 4 | 2 | 0 | 1 | 3 | 13 | 13 | 3 |
137517 | 2023-24 | 2024-04-14 | 22301190 | NYK vs. CHI | 1610612752 | New York | New York Knicks | NYK | 1628404 | Josh Hart | ... | 7 | 10 | 4 | 1 | 1 | 3 | 5 | 12 | -4 | 8 |
40820 | 2023-24 | 2024-04-14 | 22301199 | LAC vs. HOU | 1610612746 | LA | Los Angeles Clippers | LAC | 1629875 | Xavier Moon | ... | 4 | 6 | 6 | 2 | 1 | 0 | 2 | 14 | -7 | 21 |
424478 rows × 33 columns
play_off_box_scores
seasonYear | gameDate | gameId | teamId | teamCity | teamName | teamTricode | personId | personName | position | ... | reboundsDefensive | reboundsTotal | assists | steals | blocks | turnovers | foulsPersonal | points | plusMinusPoints | seconds | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
28167 | 2010-11 | 2011-04-16 | 41000161 | 1610612757 | Portland | Portland Trail Blazers | POR | 201164 | Rudy Fernandez | NaN | ... | 0 | 2 | 1 | 1 | 0 | 0 | 2 | 6 | 0 | 20 |
7013 | 2010-11 | 2011-04-16 | 41000101 | 1610612741 | Chicago | Chicago Bulls | CHI | 200758 | Ronnie Brewer | NaN | ... | 2 | 3 | 1 | 2 | 0 | 0 | 0 | 2 | -2 | 13 |
623 | 2010-11 | 2011-04-16 | 41000111 | 1610612748 | Miami | Miami Heat | MIA | 2548 | Dwyane Wade | G | ... | 6 | 7 | 5 | 0 | 1 | 2 | 5 | 17 | 16 | 23 |
101 | 2010-11 | 2011-04-16 | 41000111 | 1610612748 | Miami | Miami Heat | MIA | 980 | Zydrunas Ilgauskas | C | ... | 4 | 6 | 1 | 0 | 0 | 0 | 1 | 8 | -4 | 16 |
12474 | 2010-11 | 2011-04-16 | 41000101 | 1610612754 | Indiana | Indiana Pacers | IND | 201954 | Darren Collison | G | ... | 5 | 6 | 9 | 2 | 1 | 1 | 2 | 17 | -3 | 0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
29556 | 2023-24 | 2024-06-17 | 42300405 | 1610612742 | Dallas | Dallas Mavericks | DAL | 202693 | Markieff Morris | NaN | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
29004 | 2023-24 | 2024-06-17 | 42300405 | 1610612738 | Boston | Boston Celtics | BOS | 1628369 | Jayson Tatum | F | ... | 7 | 8 | 11 | 2 | 0 | 2 | 2 | 31 | 18 | 57 |
29118 | 2023-24 | 2024-06-17 | 42300405 | 1610612738 | Boston | Boston Celtics | BOS | 1629052 | Oshae Brissett | NaN | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 39 |
29433 | 2023-24 | 2024-06-17 | 42300405 | 1610612742 | Dallas | Dallas Mavericks | DAL | 1629029 | Luka Doncic | G | ... | 12 | 12 | 5 | 3 | 0 | 7 | 3 | 28 | -19 | 23 |
29452 | 2023-24 | 2024-06-17 | 42300405 | 1610612742 | Dallas | Dallas Mavericks | DAL | 1628467 | Maxi Kleber | NaN | ... | 2 | 3 | 1 | 0 | 0 | 0 | 2 | 2 | -12 | 26 |
31185 rows × 33 columns
regular_season_totals
seasonYear | team_ID | teamAbbreviation | teamName | gameID | gameDate | matchup | WL | minutes | fieldGoalsMade | ... | REB_RANK | AST_RANK | TOV_RANK | STL_RANK | BLK_RANK | BLKA_RANK | PF_RANK | PFD_RANK | PTS_RANK | PLUS_MINUS_RANK | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6649 | 2010-11 | 1610612747 | LAL | Los Angeles Lakers | 21000003 | 2010-10-26 | LAL vs. HOU | W | 48.0 | 40 | ... | 756 | 1197 | 567 | 174 | 1269 | 1877 | 1843 | 322 | 337 | 1116 |
9213 | 2010-11 | 1610612738 | BOS | Boston Celtics | 21000001 | 2010-10-26 | BOS vs. MIA | W | 48.0 | 32 | ... | 1050 | 502 | 2257 | 1459 | 1269 | 1586 | 767 | 1023 | 2031 | 634 |
4394 | 2010-11 | 1610612757 | POR | Portland Trail Blazers | 21000002 | 2010-10-26 | POR vs. PHX | W | 48.0 | 43 | ... | 330 | 65 | 1335 | 174 | 2024 | 813 | 1439 | 1474 | 690 | 305 |
9283 | 2010-11 | 1610612745 | HOU | Houston Rockets | 21000003 | 2010-10-26 | HOU @ LAL | L | 48.0 | 38 | ... | 85 | 502 | 2326 | 1459 | 368 | 813 | 2012 | 450 | 437 | 1288 |
6727 | 2010-11 | 1610612756 | PHX | Phoenix Suns | 21000002 | 2010-10-26 | PHX @ POR | L | 48.0 | 36 | ... | 2373 | 2190 | 2145 | 2262 | 1269 | 174 | 767 | 806 | 1763 | 2112 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
9756 | 2023-24 | 1610612740 | NOP | New Orleans Pelicans | 22301195 | 2024-04-14 | NOP vs. LAL | L | 48.0 | 41 | ... | 1785 | 1241 | 2204 | 839 | 2322 | 382 | 737 | 2212 | 1635 | 2096 |
32129 | 2023-24 | 1610612757 | POR | Portland Trail Blazers | 22301200 | 2024-04-14 | POR @ SAC | L | 48.0 | 31 | ... | 140 | 2359 | 2077 | 205 | 2080 | 1459 | 1208 | 1020 | 2449 | 2437 |
19548 | 2023-24 | 1610612752 | NYK | New York Knicks | 22301190 | 2024-04-14 | NYK vs. CHI | W | 53.0 | 46 | ... | 181 | 1031 | 2357 | 1161 | 690 | 382 | 737 | 596 | 763 | 1185 |
23458 | 2023-24 | 1610612745 | HOU | Houston Rockets | 22301199 | 2024-04-14 | HOU @ LAC | W | 48.0 | 50 | ... | 22 | 423 | 2077 | 1161 | 267 | 2012 | 143 | 2080 | 1044 | 547 |
32119 | 2023-24 | 1610612749 | MIL | Milwaukee Bucks | 22301191 | 2024-04-14 | MIL @ ORL | L | 48.0 | 30 | ... | 2268 | 2430 | 1920 | 351 | 1367 | 1096 | 968 | 1254 | 2412 | 2321 |
33316 rows × 56 columns
play_off_totals
seasonYear | team_ID | teamAbbreviation | teamName | gameID | gameDate | matchup | WL | minutes | fieldGoalsMade | ... | REB_RANK | AST_RANK | TOV_RANK | STL_RANK | BLK_RANK | BLKA_RANK | PF_RANK | PFD_RANK | PTS_RANK | PLUS_MINUS_RANK | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
94 | 2010-11 | 1610612741 | CHI | Chicago Bulls | 41000101 | 2011-04-16 | CHI vs. IND | W | 48.0 | 36 | ... | 18 | 80 | 107 | 101 | 8 | 94 | 68 | 28 | 21 | 58 |
72 | 2010-11 | 1610612755 | PHI | Philadelphia 76ers | 41000111 | 2011-04-16 | PHI @ MIA | L | 48.0 | 35 | ... | 84 | 23 | 9 | 35 | 146 | 66 | 124 | 142 | 103 | 117 |
75 | 2010-11 | 1610612757 | POR | Portland Trail Blazers | 41000161 | 2011-04-16 | POR @ DAL | L | 48.0 | 35 | ... | 77 | 23 | 87 | 67 | 122 | 109 | 136 | 142 | 150 | 117 |
5 | 2010-11 | 1610612737 | ATL | Atlanta Hawks | 41000131 | 2011-04-16 | ATL @ ORL | W | 48.0 | 38 | ... | 159 | 62 | 16 | 35 | 158 | 18 | 152 | 40 | 24 | 28 |
151 | 2010-11 | 1610612753 | ORL | Orlando Magic | 41000131 | 2011-04-16 | ORL vs. ATL | L | 48.0 | 34 | ... | 77 | 123 | 141 | 153 | 122 | 1 | 108 | 7 | 80 | 131 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2202 | 2023-24 | 1610612738 | BOS | Boston Celtics | 42300403 | 2024-06-12 | BOS @ DAL | W | 48.0 | 38 | ... | 128 | 35 | 19 | 131 | 39 | 4 | 79 | 104 | 75 | 53 |
2201 | 2023-24 | 1610612738 | BOS | Boston Celtics | 42300404 | 2024-06-14 | BOS @ DAL | L | 48.0 | 29 | ... | 153 | 136 | 102 | 158 | 65 | 12 | 79 | 104 | 158 | 162 |
2200 | 2023-24 | 1610612742 | DAL | Dallas Mavericks | 42300404 | 2024-06-14 | DAL vs. BOS | W | 48.0 | 46 | ... | 7 | 103 | 19 | 53 | 132 | 81 | 44 | 73 | 13 | 2 |
2199 | 2023-24 | 1610612738 | BOS | Boston Celtics | 42300405 | 2024-06-17 | BOS vs. DAL | W | 48.0 | 38 | ... | 13 | 49 | 19 | 18 | 132 | 57 | 17 | 56 | 75 | 23 |
2198 | 2023-24 | 1610612742 | DAL | Dallas Mavericks | 42300405 | 2024-06-17 | DAL @ BOS | L | 48.0 | 35 | ... | 134 | 136 | 91 | 131 | 85 | 12 | 93 | 134 | 154 | 141 |
2362 rows × 56 columns
Summary Statistics¶
By player, per season
regular_season_player_summary_stats = regular_season_box_scores[(~regular_season_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False))]
regular_season_player_summary_stats = regular_season_player_summary_stats.groupby(["seasonYear","personName","teamName"]).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","std"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_player_summary_stats["totalFieldGoalsPercentage"] = regular_season_player_summary_stats["totalFieldGoalsMade"]/regular_season_player_summary_stats["totalFieldGoalsAttempted"]
regular_season_player_summary_stats["totalThreePointersPercentage"] = regular_season_player_summary_stats["totalThreePointersMade"]/regular_season_player_summary_stats["totalThreePointersAttempted"]
regular_season_player_summary_stats["totalFreeThrowsPercentage"] = regular_season_player_summary_stats["totalFreeThrowsMade"]/regular_season_player_summary_stats["totalFreeThrowsAttempted"]
play_off_player_summary_stats = play_off_box_scores[(~play_off_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False))]
play_off_player_summary_stats = play_off_player_summary_stats.groupby(["seasonYear","personName","teamName"]).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","std"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
play_off_player_summary_stats["totalFieldGoalsPercentage"] = play_off_player_summary_stats["totalFieldGoalsMade"]/play_off_player_summary_stats["totalFieldGoalsAttempted"]
play_off_player_summary_stats["totalThreePointersPercentage"] = play_off_player_summary_stats["totalThreePointersMade"]/play_off_player_summary_stats["totalThreePointersAttempted"]
play_off_player_summary_stats["totalFreeThrowsPercentage"] = play_off_player_summary_stats["totalFreeThrowsMade"]/play_off_player_summary_stats["totalFreeThrowsAttempted"]
regular_season_player_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seasonYear | personName | teamName | |||||||||||||||||||||
2010-11 | AJ Price | Indiana Pacers | 769 | 15.380000 | 114 | 2.280000 | 1.512398 | 320 | 6.400000 | 0.352640 | 41 | 0.820000 | ... | 1.220000 | 1.200170 | 323 | 6.460000 | 3.866180 | 0.540000 | 27 | 0.356250 | 0.275168 | 0.666667 |
Aaron Brooks | Houston Rockets | 796 | 23.411765 | 134 | 3.941176 | 2.282226 | 387 | 11.382353 | 0.332294 | 48 | 1.411765 | ... | 2.029412 | 1.833779 | 394 | 11.588235 | 6.169906 | -3.058824 | -104 | 0.346253 | 0.284024 | 0.939759 | |
Phoenix Suns | 462 | 18.480000 | 86 | 3.440000 | 2.615339 | 200 | 8.000000 | 0.406040 | 22 | 0.880000 | ... | 1.840000 | 1.344123 | 240 | 9.600000 | 6.191392 | -2.440000 | -61 | 0.430000 | 0.328358 | 0.807018 | ||
Aaron Gray | New Orleans Pelicans | 514 | 12.536585 | 56 | 1.365854 | 1.392051 | 99 | 2.414634 | 0.453317 | 0 | 0.000000 | ... | 2.341463 | 1.824962 | 129 | 3.146341 | 3.166709 | 0.731707 | 30 | 0.565657 | NaN | 0.500000 | |
Acie Law | Golden State Warriors | 617 | 15.425000 | 78 | 1.950000 | 1.431334 | 167 | 4.175000 | 0.441100 | 6 | 0.150000 | ... | 1.275000 | 1.085747 | 203 | 5.075000 | 3.532904 | -2.075000 | -83 | 0.467066 | 0.200000 | 0.759259 | |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2023-24 | Zach LaVine | Chicago Bulls | 859 | 34.360000 | 170 | 6.800000 | 4.123106 | 376 | 15.040000 | 0.433160 | 59 | 2.360000 | ... | 2.280000 | 1.173314 | 487 | 19.480000 | 10.312290 | -3.680000 | -92 | 0.452128 | 0.349112 | 0.854369 |
Zavier Simpson | Memphis Grizzlies | 157 | 22.428571 | 17 | 2.428571 | 1.902379 | 54 | 7.714286 | 0.275286 | 5 | 0.714286 | ... | 1.571429 | 1.618347 | 42 | 6.000000 | 5.416026 | -4.142857 | -29 | 0.314815 | 0.294118 | 0.750000 | |
Zeke Nnaji | Denver Nuggets | 548 | 9.448276 | 69 | 1.189655 | 1.248956 | 149 | 2.568966 | 0.387828 | 6 | 0.103448 | ... | 1.396552 | 1.138476 | 186 | 3.206897 | 3.177545 | -2.896552 | -168 | 0.463087 | 0.260870 | 0.677419 | |
Ziaire Williams | Memphis Grizzlies | 1011 | 19.823529 | 150 | 2.941176 | 2.292699 | 378 | 7.411765 | 0.343961 | 58 | 1.137255 | ... | 1.666667 | 1.243651 | 420 | 8.235294 | 6.211564 | -4.843137 | -247 | 0.396825 | 0.306878 | 0.826667 | |
Zion Williamson | New Orleans Pelicans | 2166 | 30.942857 | 624 | 8.914286 | 2.927842 | 1094 | 15.628571 | 0.571514 | 6 | 0.085714 | ... | 2.271429 | 1.403117 | 1601 | 22.871429 | 7.243030 | 2.042857 | 143 | 0.570384 | 0.333333 | 0.702429 |
8198 rows × 52 columns
play_off_player_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seasonYear | personName | teamName | |||||||||||||||||||||
2010-11 | AJ Price | Indiana Pacers | 78 | 15.600000 | 13 | 2.600000 | 0.547723 | 35 | 7.000000 | 0.386000 | 7 | 1.400000 | ... | 1.000000 | 0.707107 | 42 | 8.400000 | 3.361547 | -3.000000 | -15 | 0.371429 | 0.437500 | 0.900000 |
Aaron Gray | New Orleans Pelicans | 85 | 14.166667 | 9 | 1.500000 | 2.073644 | 13 | 2.166667 | 0.375000 | 0 | 0.000000 | ... | 2.166667 | 1.169045 | 21 | 3.500000 | 4.969909 | 0.666667 | 4 | 0.692308 | NaN | 0.375000 | |
Al Harrington | Denver Nuggets | 68 | 13.600000 | 10 | 2.000000 | 2.449490 | 22 | 4.400000 | 0.400200 | 5 | 1.000000 | ... | 1.400000 | 0.547723 | 28 | 5.600000 | 5.639149 | -1.200000 | -6 | 0.454545 | 0.500000 | 0.750000 | |
Al Horford | Atlanta Hawks | 461 | 38.416667 | 58 | 4.833333 | 2.037527 | 137 | 11.416667 | 0.423083 | 0 | 0.000000 | ... | 2.750000 | 1.055290 | 136 | 11.333333 | 3.938928 | -5.500000 | -66 | 0.423358 | 0.000000 | 0.769231 | |
Amar'e Stoudemire | New York Knicks | 131 | 32.750000 | 21 | 5.250000 | 4.716991 | 55 | 13.750000 | 0.347250 | 0 | 0.000000 | ... | 2.500000 | 2.081666 | 58 | 14.500000 | 11.090537 | -15.000000 | -60 | 0.381818 | NaN | 0.666667 | |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2023-24 | Tyrese Maxey | Philadelphia 76ers | 351 | 43.875000 | 92 | 11.500000 | 3.625308 | 186 | 23.250000 | 0.484500 | 30 | 3.750000 | ... | 2.500000 | 1.309307 | 247 | 30.875000 | 8.951257 | -1.875000 | -15 | 0.494624 | 0.400000 | 0.916667 |
Wendell Carter Jr. | Orlando Magic | 215 | 23.888889 | 21 | 2.333333 | 1.658312 | 57 | 6.333333 | 0.359222 | 9 | 1.000000 | ... | 3.000000 | 1.802776 | 62 | 6.888889 | 3.982601 | 1.333333 | 12 | 0.368421 | 0.272727 | 0.733333 | |
Wendell Moore Jr. | Minnesota Timberwolves | 19 | 2.714286 | 3 | 0.428571 | 0.786796 | 7 | 1.000000 | 0.238143 | 1 | 0.142857 | ... | 0.428571 | 0.534522 | 7 | 1.000000 | 1.914854 | 1.714286 | 12 | 0.428571 | 0.250000 | NaN | |
Xavier Tillman | Boston Celtics | 66 | 8.250000 | 5 | 0.625000 | 0.517549 | 8 | 1.000000 | 0.562500 | 1 | 0.125000 | ... | 0.875000 | 0.834523 | 12 | 1.500000 | 1.309307 | 2.750000 | 22 | 0.625000 | 1.000000 | 1.000000 | |
Zeke Nnaji | Denver Nuggets | 13 | 4.333333 | 2 | 0.666667 | 0.577350 | 3 | 1.000000 | 0.666667 | 0 | 0.000000 | ... | 0.333333 | 0.577350 | 5 | 1.666667 | 0.577350 | -1.666667 | -5 | 0.666667 | NaN | 0.500000 |
2976 rows × 52 columns
By team, per season
#Add total minutes all players played on a team per season
regular_season_player_stats = regular_season_player_summary_stats.groupby(["teamName","seasonYear"]).agg(totalMinutesPlayersPlayed = ("totalMinutesPlayed","sum"))
play_off_player_stats = play_off_player_summary_stats.groupby(["teamName","seasonYear"]).agg(totalMinutesPlayersPlayed = ("totalMinutesPlayed","sum"))
regular_season_team_summary_stats = regular_season_totals.groupby(["teamName","seasonYear"]).agg(totalWins=("WL",lambda total: total.str.count("W").sum()),
totalLosses=("WL",lambda total: total.str.count("L").sum()),
avgWins=("WL",lambda total: total.str.count("W").mean()),
avgLosses=("WL",lambda total: total.str.count("L").mean()),
totalMinutesPlayed=("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum")).reset_index()
regular_season_team_summary_stats["totalFieldGoalsPercentage"] = regular_season_team_summary_stats["totalFieldGoalsMade"]/regular_season_team_summary_stats["totalFieldGoalsAttempted"]
regular_season_team_summary_stats["totalThreePointersPercentage"] = regular_season_team_summary_stats["totalThreePointersMade"]/regular_season_team_summary_stats["totalThreePointersAttempted"]
regular_season_team_summary_stats["totalFreeThrowsPercentage"] = regular_season_team_summary_stats["totalFreeThrowsMade"]/regular_season_team_summary_stats["totalFreeThrowsAttempted"]
regular_season_team_summary_stats = pd.merge(regular_season_team_summary_stats,regular_season_player_stats,how="left",on=["seasonYear","teamName"])
play_off_team_summary_stats = play_off_totals.groupby(["teamName","seasonYear"]).agg(totalWins=("WL",lambda total: total.str.count("W").sum()),
totalLosses=("WL",lambda total: total.str.count("L").sum()),
avgWins=("WL",lambda total: total.str.count("W").mean()),
avgLosses=("WL",lambda total: total.str.count("L").mean()),
totalMinutesPlayed=("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum")).reset_index()
play_off_team_summary_stats["totalFieldGoalsPercentage"] = play_off_team_summary_stats["totalFieldGoalsMade"]/play_off_team_summary_stats["totalFieldGoalsAttempted"]
play_off_team_summary_stats["totalThreePointersPercentage"] = play_off_team_summary_stats["totalThreePointersMade"]/play_off_team_summary_stats["totalThreePointersAttempted"]
play_off_team_summary_stats["totalFreeThrowsPercentage"] = play_off_team_summary_stats["totalFreeThrowsMade"]/play_off_team_summary_stats["totalFreeThrowsAttempted"]
play_off_team_summary_stats = pd.merge(play_off_team_summary_stats,play_off_player_stats,how="left",on=["seasonYear","teamName"])
regular_season_team_summary_stats.to_csv("regular_season_team_summary_stats.csv",index=False)
play_off_team_summary_stats.columns
Index(['teamName', 'seasonYear', 'totalWins', 'totalLosses', 'avgWins', 'avgLosses', 'totalMinutesPlayed', 'avgMinutesPlayed', 'totalFieldGoalsAttempted', 'avgFieldGoalsAttempted', 'totalFieldGoalsMade', 'avgFieldGoalsMade', 'sdFieldGoalsMade', 'avgFieldGoalsPercentage', 'sdFieldGoalsPercentage', 'totalThreePointersMade', 'avgThreePointersMade', 'sdThreePointersMade', 'totalThreePointersAttempted', 'avgThreePointersAttempted', 'avgThreePointersPercentage', 'sdThreePointersPercentage', 'totalFreeThrowsMade', 'avgFreeThrowsMade', 'sdFreeThrowsMade', 'totalFreeThrowsAttempted', 'avgFreeThrowsAttempted', 'avgFreeThrowsPercentage', 'sdFreeThrowsPercentage', 'totalReboundsOffensive', 'avgReboundsOffensive', 'sdReboundsOffensive', 'totalReboundsDefensive', 'avgReboundsDefensive', 'sdReboundsDefensive', 'totalRebounds', 'avgRebounds', 'sdRebounds', 'totalAssists', 'avgAssists', 'sdAssists', 'totalTurnovers', 'avgTurnovers', 'sdTurnovers', 'totalSteals', 'avgSteals', 'sdSteals', 'totalBlocks', 'avgBlocks', 'sdBlocks', 'totalOpponentBlocks', 'avgOpponentBlocks', 'sdOpponentBlocks', 'totalFouls', 'avgFouls', 'sdFouls', 'totalDrawnFouls', 'avgDrawnFouls', 'sdDrawnFouls', 'totalPoints', 'avgPoints', 'sdPoints', 'avgPlusMinusPoints', 'totalPlusMinusPoints', 'totalFieldGoalsPercentage', 'totalThreePointersPercentage', 'totalFreeThrowsPercentage', 'totalMinutesPlayersPlayed'], dtype='object')
By player, all time.
regular_season_player_all_time_summary_stats = regular_season_box_scores[(~regular_season_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False))]
regular_season_player_all_time_summary_stats = regular_season_player_all_time_summary_stats.groupby(["personName","teamName"]).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_player_all_time_summary_stats["totalFieldGoalsPercentage"] \
= regular_season_player_all_time_summary_stats["totalFieldGoalsMade"]/regular_season_player_all_time_summary_stats["totalFieldGoalsAttempted"]
regular_season_player_all_time_summary_stats["totalThreePointersPercentage"] \
= regular_season_player_all_time_summary_stats["totalThreePointersMade"]/regular_season_player_all_time_summary_stats["totalThreePointersAttempted"]
regular_season_player_all_time_summary_stats["totalFreeThrowsPercentage"] \
= regular_season_player_all_time_summary_stats["totalFreeThrowsMade"]/regular_season_player_all_time_summary_stats["totalFreeThrowsAttempted"]
play_off_player_all_time_summary_stats = play_off_box_scores[(~play_off_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False))]
play_off_player_all_time_summary_stats = play_off_player_all_time_summary_stats.groupby(["personName","teamName"]).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
play_off_player_all_time_summary_stats["totalFieldGoalsPercentage"] = play_off_player_all_time_summary_stats["totalFieldGoalsMade"]/play_off_player_all_time_summary_stats["totalFieldGoalsAttempted"]
play_off_player_all_time_summary_stats["totalThreePointersPercentage"] \
= play_off_player_all_time_summary_stats["totalThreePointersMade"]/play_off_player_all_time_summary_stats["totalThreePointersAttempted"]
play_off_player_all_time_summary_stats["totalFreeThrowsPercentage"] = play_off_player_all_time_summary_stats["totalFreeThrowsMade"]/play_off_player_all_time_summary_stats["totalFreeThrowsAttempted"]
regular_season_player_all_time_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
personName | teamName | |||||||||||||||||||||
A.J. Lawson | Dallas Mavericks | 387 | 6.910714 | 75 | 1.339286 | 1.575688 | 164 | 2.928571 | 0.369107 | 23 | 0.410714 | ... | 0.571429 | 0.988243 | 190 | 3.392857 | 4.066173 | -0.410714 | -23 | 0.457317 | 0.306667 | 0.548387 |
Minnesota Timberwolves | 1 | 1.000000 | 1 | 1.000000 | NaN | 1 | 1.000000 | 1.000000 | 0 | 0.000000 | ... | 1.000000 | NaN | 2 | 2.000000 | NaN | -5.000000 | -5 | 1.000000 | NaN | NaN | |
AJ Green | Milwaukee Bucks | 917 | 10.076923 | 136 | 1.494505 | 1.675799 | 321 | 3.527473 | 0.321626 | 113 | 1.241758 | ... | 0.879121 | 0.952601 | 406 | 4.461538 | 4.973949 | 0.263736 | 24 | 0.423676 | 0.412409 | 0.913043 |
AJ Griffin | Atlanta Hawks | 1529 | 16.619565 | 266 | 2.891304 | 2.341487 | 595 | 6.467391 | 0.425109 | 111 | 1.206522 | ... | 1.010870 | 1.010870 | 687 | 7.467391 | 5.610922 | 0.130435 | 12 | 0.447059 | 0.372483 | 0.897959 |
AJ Hammons | Dallas Mavericks | 154 | 7.000000 | 17 | 0.772727 | 1.109776 | 42 | 1.909091 | 0.263773 | 5 | 0.227273 | ... | 0.954545 | 1.396502 | 48 | 2.181818 | 3.201731 | -0.227273 | -5 | 0.404762 | 0.500000 | 0.450000 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Zoran Dragic | Miami Heat | 58 | 5.800000 | 9 | 0.900000 | 2.846050 | 22 | 2.200000 | 0.052900 | 3 | 0.300000 | ... | 0.500000 | 0.971825 | 22 | 2.200000 | 6.957011 | -1.300000 | -13 | 0.409091 | 0.333333 | 0.500000 |
Phoenix Suns | 10 | 1.666667 | 2 | 0.333333 | 0.516398 | 8 | 1.333333 | 0.138833 | 0 | 0.000000 | ... | 0.166667 | 0.408248 | 6 | 1.000000 | 1.264911 | -0.333333 | -2 | 0.250000 | 0.000000 | 0.666667 | |
Zydrunas Ilgauskas | Miami Heat | 1106 | 15.361111 | 162 | 2.250000 | 1.851912 | 319 | 4.430556 | 0.430847 | 0 | 0.000000 | ... | 2.569444 | 1.330322 | 360 | 5.000000 | 4.038547 | 2.944444 | 212 | 0.507837 | 0.000000 | 0.782609 |
Zylan Cheatham | New Orleans Pelicans | 48 | 12.000000 | 6 | 1.500000 | 1.732051 | 9 | 2.250000 | 0.583250 | 0 | 0.000000 | ... | 2.500000 | 2.081666 | 12 | 3.000000 | 3.464102 | -7.000000 | -28 | 0.666667 | 0.000000 | NaN |
Utah Jazz | 5 | 5.000000 | 0 | 0.000000 | NaN | 3 | 3.000000 | 0.000000 | 0 | 0.000000 | ... | 0.000000 | NaN | 0 | 0.000000 | NaN | -13.000000 | -13 | 0.000000 | 0.000000 | NaN |
4431 rows × 52 columns
play_off_player_all_time_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
personName | teamName | |||||||||||||||||||||
A.J. Lawson | Dallas Mavericks | 0 | 0.000000 | 0 | 0.000000 | NaN | 0 | 0.000000 | 0.000000 | 0 | 0.000000 | ... | 0.000000 | NaN | 0 | 0.000000 | NaN | -2.000000 | -2 | NaN | NaN | NaN |
AJ Green | Milwaukee Bucks | 70 | 10.000000 | 6 | 0.857143 | 1.214986 | 19 | 2.714286 | 0.275571 | 2 | 0.285714 | ... | 1.428571 | 0.975900 | 17 | 2.428571 | 3.258688 | -0.428571 | -3 | 0.315789 | 0.142857 | 1.000000 |
AJ Lawson | Dallas Mavericks | 26 | 2.600000 | 4 | 0.400000 | 0.516398 | 9 | 0.900000 | 0.250000 | 2 | 0.200000 | ... | 0.100000 | 0.316228 | 11 | 1.100000 | 1.286684 | -1.200000 | -12 | 0.444444 | 0.333333 | 0.500000 |
AJ Price | Indiana Pacers | 83 | 9.222222 | 14 | 1.555556 | 1.333333 | 37 | 4.111111 | 0.325556 | 7 | 0.777778 | ... | 0.555556 | 0.726483 | 44 | 4.888889 | 4.833333 | -2.666667 | -24 | 0.378378 | 0.437500 | 0.900000 |
Aaron Brooks | Chicago Bulls | 126 | 10.500000 | 21 | 1.750000 | 1.055290 | 61 | 5.083333 | 0.361750 | 8 | 0.666667 | ... | 1.333333 | 1.302678 | 54 | 4.500000 | 3.370999 | -3.166667 | -38 | 0.344262 | 0.307692 | 0.571429 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Zeke Nnaji | Denver Nuggets | 47 | 3.133333 | 9 | 0.600000 | 0.736788 | 16 | 1.066667 | 0.466667 | 5 | 0.333333 | ... | 0.266667 | 0.457738 | 25 | 1.666667 | 1.988060 | 0.333333 | 5 | 0.562500 | 0.454545 | 0.500000 |
Zhaire Smith | Philadelphia 76ers | 5 | 2.500000 | 0 | 0.000000 | 0.000000 | 0 | 0.000000 | 0.000000 | 0 | 0.000000 | ... | 0.000000 | 0.000000 | 0 | 0.000000 | 0.000000 | 6.000000 | 12 | NaN | NaN | NaN |
Zhou Qi | Houston Rockets | 4 | 1.333333 | 1 | 0.333333 | 0.577350 | 1 | 0.333333 | 0.333333 | 0 | 0.000000 | ... | 0.000000 | 0.000000 | 2 | 0.666667 | 1.154701 | 0.000000 | 0 | 1.000000 | NaN | NaN |
Ziaire Williams | Memphis Grizzlies | 174 | 12.428571 | 25 | 1.785714 | 1.528125 | 59 | 4.214286 | 0.317286 | 12 | 0.857143 | ... | 1.071429 | 1.206666 | 74 | 5.285714 | 4.794686 | -3.285714 | -46 | 0.423729 | 0.307692 | 0.923077 |
Zydrunas Ilgauskas | Miami Heat | 100 | 11.111111 | 14 | 1.555556 | 1.810463 | 30 | 3.333333 | 0.450667 | 0 | 0.000000 | ... | 1.777778 | 1.201850 | 32 | 3.555556 | 3.745368 | -7.222222 | -65 | 0.466667 | NaN | 0.666667 |
1745 rows × 52 columns
By team, all time.
#Add total minutes all players played on a team per season
regular_season_player_all_time_stats = regular_season_player_summary_stats.groupby(["teamName"]).agg(totalMinutesPlayersPlayed=("totalMinutesPlayed","sum"))
play_off_player_all_time_stats = play_off_player_summary_stats.groupby(["teamName"]).agg(totalMinutesPlayersPlayed=("totalMinutesPlayed","sum"))
regular_season_team_all_time_summary_stats = regular_season_totals.groupby(["teamName"]).agg(totalWins=("WL",lambda total: total.str.count("W").sum()),
totalLosses=("WL",lambda total: total.str.count("L").sum()),
avgWins=("WL",lambda total: total.str.count("W").mean()),
avgLosses=("WL",lambda total: total.str.count("L").mean()),
totalMinutesPlayed=("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_team_all_time_summary_stats["totalFieldGoalsPercentage"] \
= regular_season_team_all_time_summary_stats["totalFieldGoalsMade"]/regular_season_team_all_time_summary_stats["totalFieldGoalsAttempted"]
regular_season_team_all_time_summary_stats["totalThreePointersPercentage"]\
= regular_season_team_all_time_summary_stats["totalThreePointersMade"]/regular_season_team_all_time_summary_stats["totalThreePointersAttempted"]
regular_season_team_all_time_summary_stats["totalFreeThrowsPercentage"] \
= regular_season_team_all_time_summary_stats["totalFreeThrowsMade"]/regular_season_team_all_time_summary_stats["totalFreeThrowsAttempted"]
regular_season_team_all_time_summary_stats = pd.merge(regular_season_team_all_time_summary_stats,regular_season_player_all_time_stats,how="left",on=["seasonYear","teamName"])
play_off_team_all_time_summary_stats = play_off_totals.groupby(["teamName"]).agg(totalWins=("WL",lambda total: total.str.count("W").sum()),
totalLosses=("WL",lambda total: total.str.count("L").sum()),
avgWins=("WL",lambda total: total.str.count("W").mean()),
avgLosses=("WL",lambda total: total.str.count("L").mean()),
totalMinutesPlayed=("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
play_off_team_all_time_summary_stats["totalFieldGoalsPercentage"] \
= play_off_team_all_time_summary_stats["totalFieldGoalsMade"]/play_off_team_all_time_summary_stats["totalFieldGoalsAttempted"]
play_off_team_all_time_summary_stats["totalThreePointersPercentage"] \
= play_off_team_all_time_summary_stats["totalThreePointersMade"]/play_off_team_all_time_summary_stats["totalThreePointersAttempted"]
play_off_team_all_time_summary_stats["totalFreeThrowsPercentage"] \
= play_off_team_all_time_summary_stats["totalFreeThrowsMade"]/play_off_team_all_time_summary_stats["totalFreeThrowsAttempted"]
play_off_team_all_time_summary_stats = pd.merge(play_off_team_all_time_summary_stats,play_off_player_all_time_stats,how="left",on=["seasonYear","teamName"])
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) /var/folders/5y/f2gxs3rd1px9742dhtwbjbc40000gn/T/ipykernel_72728/1994423603.py in ?() ---> 76 #Add total minutes all players played on a team per season 77 78 regular_season_player_all_time_stats = regular_season_player_summary_stats.groupby(["teamName"]).agg(totalMinutesPlayersPlayed=("totalMinutesPlayed","sum")) 79 ~/Library/Python/3.9/lib/python/site-packages/pandas/core/reshape/merge.py in ?(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate) 166 validate=validate, 167 copy=copy, 168 ) 169 else: --> 170 op = _MergeOperation( 171 left_df, 172 right_df, 173 how=how, ~/Library/Python/3.9/lib/python/site-packages/pandas/core/reshape/merge.py in ?(self, left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, indicator, validate) 790 self.right_join_keys, 791 self.join_names, 792 left_drop, 793 right_drop, --> 794 ) = self._get_merge_keys() 795 796 if left_drop: 797 self.left = self.left._drop_labels_or_levels(left_drop) ~/Library/Python/3.9/lib/python/site-packages/pandas/core/reshape/merge.py in ?(self) 1294 # Then we're either Hashable or a wrong-length arraylike, 1295 # the latter of which will raise 1296 rk = cast(Hashable, rk) 1297 if rk is not None: -> 1298 right_keys.append(right._get_label_or_level_values(rk)) 1299 else: 1300 # work-around for merge_asof(right_index=True) 1301 right_keys.append(right.index._values) ~/Library/Python/3.9/lib/python/site-packages/pandas/core/generic.py in ?(self, key, axis) 1907 values = self.xs(key, axis=other_axes[0])._values 1908 elif self._is_level_reference(key, axis=axis): 1909 values = self.axes[axis].get_level_values(key)._values 1910 else: -> 1911 raise KeyError(key) 1912 1913 # Check for duplicates 1914 if values.ndim > 1: KeyError: 'seasonYear'
regular_season_team_all_time_summary_stats
totalWins | totalLosses | avgWins | avgLosses | totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsAttempted | avgFieldGoalsAttempted | totalFieldGoalsMade | avgFieldGoalsMade | ... | avgDrawnFouls | sdDrawnFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
teamName | |||||||||||||||||||||
Atlanta Hawks | 551 | 556 | 0.497742 | 0.502258 | 53536.000 | 48.361337 | 94935 | 85.758808 | 43727 | 39.500452 | ... | 19.894309 | 4.277093 | 117980 | 106.576332 | 14.195111 | -0.460705 | -510 | 0.460599 | 0.359501 | 0.776789 |
Boston Celtics | 662 | 449 | 0.595860 | 0.404140 | 53763.000 | 48.391539 | 95241 | 85.725473 | 43888 | 39.503150 | ... | 19.411341 | 4.194700 | 118282 | 106.464446 | 14.105725 | 3.594059 | 3993 | 0.460810 | 0.362620 | 0.788377 |
Brooklyn Nets | 492 | 620 | 0.442446 | 0.557554 | 53816.000 | 48.395683 | 94399 | 84.891187 | 42986 | 38.656475 | ... | 19.893885 | 4.319745 | 116822 | 105.055755 | 14.073631 | -2.128597 | -2367 | 0.455365 | 0.357237 | 0.766433 |
Charlotte Hornets | 444 | 661 | 0.401810 | 0.598190 | 53430.000 | 48.352941 | 94312 | 85.350226 | 41875 | 37.895928 | ... | 20.318552 | 4.098191 | 113611 | 102.815385 | 14.125548 | -3.624434 | -4005 | 0.444005 | 0.349805 | 0.762362 |
Chicago Bulls | 565 | 540 | 0.511312 | 0.488688 | 53505.000 | 48.420814 | 94646 | 85.652489 | 43015 | 38.927602 | ... | 18.997285 | 4.077042 | 114395 | 103.524887 | 13.187251 | -0.087783 | -97 | 0.454483 | 0.357981 | 0.778403 |
Cleveland Cavaliers | 511 | 594 | 0.462443 | 0.537557 | 53390.000 | 48.316742 | 93549 | 84.659729 | 42696 | 38.638914 | ... | 20.155656 | 4.059702 | 115356 | 104.394570 | 13.056870 | -1.599095 | -1767 | 0.456403 | 0.359682 | 0.756784 |
Dallas Mavericks | 590 | 525 | 0.529148 | 0.470852 | 53940.000 | 48.376682 | 94777 | 85.001794 | 43617 | 39.118386 | ... | 20.505830 | 4.406694 | 118554 | 106.326457 | 13.362007 | 1.048430 | 1169 | 0.460207 | 0.359460 | 0.772677 |
Denver Nuggets | 635 | 478 | 0.570530 | 0.429470 | 53793.985 | 48.332421 | 96239 | 86.468104 | 45332 | 40.729560 | ... | 20.556155 | 4.439718 | 121441 | 109.111411 | 12.948438 | 1.945193 | 2165 | 0.471036 | 0.359730 | 0.755947 |
Detroit Pistons | 400 | 706 | 0.361664 | 0.638336 | 53468.000 | 48.343580 | 94878 | 85.784810 | 42426 | 38.359855 | ... | 19.696203 | 4.228959 | 113451 | 102.577758 | 12.703005 | -3.621157 | -4005 | 0.447164 | 0.348187 | 0.732685 |
Golden State Warriors | 676 | 429 | 0.611765 | 0.388235 | 53345.000 | 48.276018 | 96183 | 87.043439 | 45584 | 41.252489 | ... | 18.827149 | 4.129031 | 122280 | 110.660633 | 13.613909 | 3.675113 | 4061 | 0.473930 | 0.383163 | 0.781324 |
Houston Rockets | 590 | 522 | 0.530576 | 0.469424 | 53721.000 | 48.310252 | 95516 | 85.895683 | 43469 | 39.090827 | ... | 20.875000 | 4.594407 | 121715 | 109.455935 | 12.859899 | 0.995504 | 1107 | 0.455097 | 0.351699 | 0.752448 |
Indiana Pacers | 591 | 521 | 0.531475 | 0.468525 | 53721.000 | 48.310252 | 95524 | 85.902878 | 44134 | 39.688849 | ... | 20.104317 | 4.220082 | 117804 | 105.938849 | 14.101019 | 1.071942 | 1192 | 0.462020 | 0.361750 | 0.775943 |
Los Angeles Clippers | 668 | 444 | 0.600719 | 0.399281 | 53626.000 | 48.224820 | 93925 | 84.464928 | 44248 | 39.791367 | ... | 21.282374 | 4.786094 | 120547 | 108.405576 | 13.275455 | 3.192446 | 3550 | 0.471099 | 0.372045 | 0.750410 |
Los Angeles Lakers | 523 | 588 | 0.470747 | 0.529253 | 53733.000 | 48.364536 | 95729 | 86.164716 | 44166 | 39.753375 | ... | 20.405041 | 4.321091 | 118643 | 106.789379 | 13.250827 | -1.390639 | -1545 | 0.461365 | 0.348917 | 0.744922 |
Memphis Grizzlies | 594 | 519 | 0.533693 | 0.466307 | 53794.000 | 48.332435 | 95574 | 85.870620 | 43429 | 39.019766 | ... | 20.088949 | 4.257261 | 115192 | 103.496855 | 13.307387 | 0.363881 | 405 | 0.454402 | 0.346993 | 0.763199 |
Miami Heat | 660 | 453 | 0.592992 | 0.407008 | 53824.000 | 48.359389 | 91568 | 82.271339 | 42870 | 38.517520 | ... | 20.180593 | 4.191751 | 116252 | 104.449236 | 12.127744 | 2.489668 | 2771 | 0.468177 | 0.362396 | 0.766204 |
Milwaukee Bucks | 599 | 514 | 0.538185 | 0.461815 | 53774.000 | 48.314465 | 95833 | 86.103324 | 44470 | 39.955076 | ... | 19.761006 | 4.089426 | 119192 | 107.090746 | 15.426136 | 1.331536 | 1482 | 0.464036 | 0.361958 | 0.759747 |
Minnesota Timberwolves | 459 | 645 | 0.415761 | 0.584239 | 53362.000 | 48.335145 | 95291 | 86.314312 | 43498 | 39.400362 | ... | 21.244565 | 4.230439 | 118231 | 107.093297 | 13.104413 | -1.484601 | -1639 | 0.456475 | 0.351229 | 0.775019 |
New Orleans Pelicans | 506 | 606 | 0.455036 | 0.544964 | 53751.000 | 48.337230 | 95205 | 85.616007 | 44202 | 39.750000 | ... | 19.923561 | 4.157617 | 117712 | 105.856115 | 14.099970 | -0.730216 | -812 | 0.464282 | 0.358441 | 0.763785 |
New York Knicks | 491 | 615 | 0.443942 | 0.556058 | 53458.000 | 48.334539 | 94722 | 85.643761 | 42538 | 38.461121 | ... | 19.588608 | 4.140498 | 114952 | 103.934901 | 12.844257 | -1.295660 | -1433 | 0.449083 | 0.357825 | 0.767924 |
Oklahoma City Thunder | 652 | 460 | 0.586331 | 0.413669 | 53806.000 | 48.386691 | 96139 | 86.455935 | 44410 | 39.937050 | ... | 20.449640 | 4.190897 | 120802 | 108.634892 | 12.741838 | 2.515288 | 2797 | 0.461935 | 0.350856 | 0.778560 |
Orlando Magic | 445 | 668 | 0.399820 | 0.600180 | 53749.000 | 48.292004 | 94824 | 85.196765 | 42706 | 38.370171 | ... | 19.043127 | 4.041592 | 113825 | 102.268643 | 12.973849 | -3.091644 | -3441 | 0.450371 | 0.347304 | 0.751294 |
Philadelphia 76ers | 532 | 581 | 0.477987 | 0.522013 | 53793.985 | 48.332421 | 95131 | 85.472597 | 43304 | 38.907457 | ... | 19.476190 | 4.383752 | 116599 | 104.761006 | 14.117200 | -0.706199 | -786 | 0.455204 | 0.356123 | 0.760431 |
Phoenix Suns | 515 | 598 | 0.462713 | 0.537287 | 53754.000 | 48.296496 | 96298 | 86.521114 | 44528 | 40.007188 | ... | 20.394429 | 4.378028 | 119234 | 107.128482 | 13.027800 | -1.390836 | -1548 | 0.462398 | 0.356249 | 0.776801 |
Portland Trail Blazers | 559 | 555 | 0.501795 | 0.498205 | 53832.000 | 48.323160 | 96380 | 86.517056 | 43646 | 39.179533 | ... | 19.657989 | 4.147623 | 118624 | 106.484740 | 13.100148 | -0.604129 | -673 | 0.452853 | 0.362708 | 0.793513 |
Sacramento Kings | 448 | 664 | 0.402878 | 0.597122 | 53741.000 | 48.328237 | 96151 | 86.466727 | 44311 | 39.848022 | ... | 20.485612 | 4.469898 | 118693 | 106.738309 | 13.620907 | -3.094424 | -3441 | 0.460848 | 0.359174 | 0.753570 |
San Antonio Spurs | 652 | 459 | 0.586859 | 0.413141 | 53708.000 | 48.342034 | 95870 | 86.291629 | 45210 | 40.693069 | ... | 19.315032 | 3.988919 | 119434 | 107.501350 | 12.404582 | 2.605761 | 2895 | 0.471576 | 0.369282 | 0.781737 |
Toronto Raptors | 594 | 518 | 0.534173 | 0.465827 | 53791.000 | 48.373201 | 95250 | 85.656475 | 43539 | 39.153777 | ... | 20.031475 | 4.293035 | 118203 | 106.297662 | 13.065454 | 1.538669 | 1711 | 0.457102 | 0.355862 | 0.782724 |
Utah Jazz | 583 | 529 | 0.524281 | 0.475719 | 53736.000 | 48.323741 | 93239 | 83.848022 | 43039 | 38.704137 | ... | 20.415468 | 4.243071 | 117124 | 105.327338 | 13.912639 | 1.285072 | 1429 | 0.461599 | 0.360747 | 0.765238 |
Washington Wizards | 471 | 641 | 0.423561 | 0.576439 | 53826.000 | 48.404676 | 96108 | 86.428058 | 44449 | 39.972122 | ... | 19.971223 | 4.249327 | 117863 | 105.991906 | 13.938754 | -2.390288 | -2658 | 0.462490 | 0.355520 | 0.759152 |
30 rows × 65 columns
play_off_team_all_time_summary_stats
totalWins | totalLosses | avgWins | avgLosses | totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsAttempted | avgFieldGoalsAttempted | totalFieldGoalsMade | avgFieldGoalsMade | ... | avgDrawnFouls | sdDrawnFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
teamName | |||||||||||||||||||||
Atlanta Hawks | 40 | 52 | 0.434783 | 0.565217 | 4436.0 | 48.217391 | 7656 | 83.217391 | 3312 | 36.000000 | ... | 20.663043 | 4.274322 | 9008 | 97.913043 | 12.626200 | -2.804348 | -258 | 0.432602 | 0.333075 | 0.775013 |
Boston Celtics | 98 | 79 | 0.553672 | 0.446328 | 8566.0 | 48.395480 | 14601 | 82.491525 | 6550 | 37.005650 | ... | 20.180791 | 4.266821 | 18190 | 102.768362 | 13.115636 | 1.276836 | 226 | 0.448599 | 0.352503 | 0.798149 |
Brooklyn Nets | 18 | 36 | 0.333333 | 0.666667 | 2617.0 | 48.462963 | 4463 | 82.648148 | 2011 | 37.240741 | ... | 21.129630 | 5.005832 | 5556 | 102.888889 | 14.655370 | -2.944444 | -159 | 0.450594 | 0.353165 | 0.772763 |
Charlotte Hornets | 3 | 8 | 0.272727 | 0.727273 | 528.0 | 48.000000 | 864 | 78.545455 | 358 | 32.545455 | ... | 20.909091 | 4.548726 | 1000 | 90.909091 | 7.930379 | -9.181818 | -101 | 0.414352 | 0.330233 | 0.794776 |
Chicago Bulls | 26 | 36 | 0.419355 | 0.580645 | 3011.0 | 48.564516 | 5076 | 81.870968 | 2155 | 34.758065 | ... | 19.806452 | 3.784519 | 5746 | 92.677419 | 12.915582 | -1.903226 | -118 | 0.424547 | 0.328473 | 0.763636 |
Cleveland Cavaliers | 63 | 37 | 0.630000 | 0.370000 | 4825.0 | 48.250000 | 8223 | 82.230000 | 3742 | 37.420000 | ... | 21.270000 | 4.239914 | 10338 | 103.380000 | 12.864311 | 2.960000 | 296 | 0.455065 | 0.362347 | 0.745690 |
Dallas Mavericks | 48 | 48 | 0.500000 | 0.500000 | 4618.0 | 48.104167 | 7856 | 81.833333 | 3575 | 37.239583 | ... | 21.520833 | 4.026175 | 9949 | 103.635417 | 12.919280 | -0.697917 | -67 | 0.455066 | 0.368872 | 0.759031 |
Denver Nuggets | 52 | 48 | 0.520000 | 0.480000 | 4840.0 | 48.400000 | 8617 | 86.170000 | 3968 | 39.680000 | ... | 21.160000 | 4.189260 | 10759 | 107.590000 | 13.153403 | -0.040000 | -4 | 0.460485 | 0.356974 | 0.781416 |
Detroit Pistons | 0 | 8 | 0.000000 | 1.000000 | 384.0 | 48.000000 | 688 | 86.000000 | 294 | 36.750000 | ... | 20.125000 | 2.799872 | 772 | 96.500000 | 6.654751 | -16.125000 | -129 | 0.427326 | 0.349558 | 0.681818 |
Golden State Warriors | 108 | 51 | 0.679245 | 0.320755 | 7682.0 | 48.314465 | 13711 | 86.232704 | 6427 | 40.421384 | ... | 20.993711 | 3.969021 | 17520 | 110.188679 | 11.574289 | 5.427673 | 863 | 0.468748 | 0.372757 | 0.766685 |
Houston Rockets | 42 | 43 | 0.494118 | 0.505882 | 4110.0 | 48.352941 | 7217 | 84.905882 | 3151 | 37.070588 | ... | 22.082353 | 4.840828 | 9022 | 106.141176 | 12.104852 | -0.952941 | -81 | 0.436608 | 0.343023 | 0.728151 |
Indiana Pacers | 42 | 56 | 0.428571 | 0.571429 | 4724.0 | 48.204082 | 7785 | 79.438776 | 3526 | 35.979592 | ... | 20.836735 | 4.361722 | 9530 | 97.244898 | 13.066887 | -0.744898 | -73 | 0.452922 | 0.357950 | 0.748755 |
Los Angeles Clippers | 47 | 60 | 0.439252 | 0.560748 | 5151.0 | 48.140187 | 8864 | 82.841121 | 4105 | 38.364486 | ... | 22.663551 | 4.503550 | 11344 | 106.018692 | 14.258385 | -0.261682 | -28 | 0.463109 | 0.359933 | 0.744681 |
Los Angeles Lakers | 36 | 40 | 0.473684 | 0.526316 | 3653.0 | 48.065789 | 6324 | 83.210526 | 2917 | 38.381579 | ... | 21.105263 | 3.657245 | 7886 | 103.763158 | 13.205926 | -0.250000 | -19 | 0.461259 | 0.326998 | 0.771940 |
Memphis Grizzlies | 38 | 48 | 0.441860 | 0.558140 | 4203.0 | 48.872093 | 7319 | 85.104651 | 3130 | 36.395349 | ... | 22.360465 | 4.891560 | 8516 | 99.023256 | 13.118444 | -2.825581 | -243 | 0.427654 | 0.331810 | 0.767644 |
Miami Heat | 106 | 72 | 0.595506 | 0.404494 | 8609.0 | 48.365169 | 14134 | 79.404494 | 6467 | 36.331461 | ... | 20.943820 | 4.491950 | 17864 | 100.359551 | 11.749982 | 2.011236 | 358 | 0.457549 | 0.357633 | 0.780196 |
Milwaukee Bucks | 49 | 46 | 0.515789 | 0.484211 | 4610.0 | 48.526316 | 8268 | 87.031579 | 3755 | 39.526316 | ... | 20.589474 | 3.805077 | 10081 | 106.115789 | 13.674688 | 1.168421 | 111 | 0.454161 | 0.340266 | 0.723303 |
Minnesota Timberwolves | 14 | 19 | 0.424242 | 0.575758 | 1589.0 | 48.151515 | 2732 | 82.787879 | 1261 | 38.212121 | ... | 20.636364 | 3.911667 | 3530 | 106.969697 | 11.430455 | -0.878788 | -29 | 0.461567 | 0.369335 | 0.778331 |
New Orleans Pelicans | 9 | 21 | 0.300000 | 0.700000 | 1445.0 | 48.166667 | 2516 | 83.866667 | 1140 | 38.000000 | ... | 19.666667 | 3.753925 | 3038 | 101.266667 | 13.952959 | -5.200000 | -156 | 0.453100 | 0.331081 | 0.783206 |
New York Knicks | 23 | 29 | 0.442308 | 0.557692 | 2506.0 | 48.192308 | 4323 | 83.134615 | 1830 | 35.192308 | ... | 20.384615 | 3.464972 | 5070 | 97.500000 | 12.817727 | -2.307692 | -120 | 0.423317 | 0.337903 | 0.766722 |
Oklahoma City Thunder | 62 | 57 | 0.521008 | 0.478992 | 5772.0 | 48.504202 | 9846 | 82.739496 | 4403 | 37.000000 | ... | 21.697479 | 3.685875 | 12245 | 102.899160 | 10.945470 | 1.042017 | 124 | 0.447187 | 0.336467 | 0.800854 |
Orlando Magic | 8 | 22 | 0.266667 | 0.733333 | 1445.0 | 48.166667 | 2456 | 81.866667 | 992 | 33.066667 | ... | 21.833333 | 3.806377 | 2817 | 93.900000 | 12.388398 | -5.133333 | -154 | 0.403909 | 0.313163 | 0.757746 |
Philadelphia 76ers | 42 | 45 | 0.482759 | 0.517241 | 4196.0 | 48.229885 | 7231 | 83.114943 | 3224 | 37.057471 | ... | 20.942529 | 5.051724 | 8972 | 103.126437 | 15.670892 | 0.471264 | 41 | 0.445858 | 0.353552 | 0.777778 |
Phoenix Suns | 27 | 24 | 0.529412 | 0.470588 | 2448.0 | 48.000000 | 4280 | 83.921569 | 2083 | 40.843137 | ... | 20.274510 | 3.671939 | 5561 | 109.039216 | 12.843614 | -0.490196 | -25 | 0.486682 | 0.368236 | 0.830315 |
Portland Trail Blazers | 24 | 44 | 0.352941 | 0.647059 | 3319.0 | 48.808824 | 5942 | 87.382353 | 2574 | 37.852941 | ... | 21.558824 | 3.529756 | 7133 | 104.897059 | 13.597783 | -5.191176 | -353 | 0.433187 | 0.361776 | 0.784070 |
Sacramento Kings | 3 | 4 | 0.428571 | 0.571429 | 336.0 | 48.000000 | 669 | 95.571429 | 287 | 41.000000 | ... | 22.714286 | 2.751623 | 796 | 113.714286 | 11.324226 | -2.142857 | -15 | 0.428999 | 0.305755 | 0.761111 |
San Antonio Spurs | 64 | 45 | 0.587156 | 0.412844 | 5287.0 | 48.504587 | 8976 | 82.348624 | 4190 | 38.440367 | ... | 21.146789 | 3.748643 | 11211 | 102.853211 | 10.156940 | 4.385321 | 478 | 0.466800 | 0.377288 | 0.761980 |
Toronto Raptors | 46 | 46 | 0.500000 | 0.500000 | 4466.0 | 48.543478 | 7641 | 83.054348 | 3367 | 36.597826 | ... | 20.967391 | 4.109627 | 9346 | 101.586957 | 12.686544 | -1.380435 | -127 | 0.440649 | 0.336822 | 0.791763 |
Utah Jazz | 21 | 34 | 0.381818 | 0.618182 | 2645.0 | 48.090909 | 4522 | 82.218182 | 2037 | 37.036364 | ... | 21.090909 | 3.340397 | 5710 | 103.818182 | 13.568879 | -3.727273 | -205 | 0.450464 | 0.361206 | 0.748132 |
Washington Wizards | 22 | 23 | 0.488889 | 0.511111 | 2175.0 | 48.333333 | 3815 | 84.777778 | 1714 | 38.088889 | ... | 22.044444 | 3.598962 | 4603 | 102.288889 | 13.395424 | -0.733333 | -33 | 0.449279 | 0.343195 | 0.757326 |
30 rows × 65 columns
By position, all time.
regular_season_position_all_time_summary_stats = regular_season_box_scores[~(regular_season_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False))]
regular_season_position_all_time_summary_stats = regular_season_position_all_time_summary_stats.groupby(["position"],dropna=False).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","std"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_position_all_time_summary_stats["totalFieldGoalsPercentage"] = regular_season_position_all_time_summary_stats["totalFieldGoalsMade"]/ \
regular_season_position_all_time_summary_stats["totalFieldGoalsAttempted"]
regular_season_position_all_time_summary_stats["totalThreePointersPercentage"] = regular_season_position_all_time_summary_stats["totalThreePointersMade"]/ \
regular_season_position_all_time_summary_stats["totalThreePointersAttempted"]
regular_season_position_all_time_summary_stats["totalFreeThrowsPercentage"] = regular_season_position_all_time_summary_stats["totalFreeThrowsMade"]/ \
regular_season_position_all_time_summary_stats["totalFreeThrowsAttempted"]
play_off_position_all_time_summary_stats = play_off_box_scores[~play_off_box_scores["comment"].str.contains("DND|DNP|NWT",na=False,case=False)]
play_off_position_all_time_summary_stats = play_off_position_all_time_summary_stats.groupby(["position"],dropna=False).agg(totalMinutesPlayed = ("minutes","sum"),
avgMinutesPlayed=("minutes","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
avgFieldGoalPercentage=("fieldGoalsPercentage","mean"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","mean"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","std"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_position_all_time_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
position | |||||||||||||||||||||
C | 912279 | 27.382609 | 166266 | 4.990575 | 3.076156 | 310802 | 9.328911 | 0.536364 | 11226 | 0.336955 | ... | 2.698553 | 1.467335 | 417720 | 12.538120 | 7.710343 | 0.318706 | 10618 | 0.534958 | 0.346792 | 0.696139 |
F | 1997666 | 29.980580 | 346576 | 5.201345 | 3.157402 | 743240 | 11.154400 | 0.455862 | 82149 | 1.232876 | ... | 2.312808 | 1.450711 | 932157 | 13.989630 | 8.366858 | 0.338801 | 22575 | 0.466304 | 0.360781 | 0.775268 |
G | 2077703 | 31.181760 | 372281 | 5.587120 | 3.214452 | 841458 | 12.628437 | 0.432528 | 115530 | 1.733852 | ... | 2.163570 | 1.400480 | 1035005 | 15.533152 | 8.862222 | 0.367646 | 24497 | 0.442424 | 0.368486 | 0.816946 |
NaN | 2891955 | 15.639713 | 426189 | 2.304833 | 2.171171 | 957936 | 5.180525 | 0.391191 | 119919 | 0.648523 | ... | 1.509991 | 1.369040 | 1147931 | 6.208019 | 5.715058 | -0.311988 | -57690 | 0.444903 | 0.348438 | 0.743997 |
4 rows × 52 columns
play_off_position_all_time_summary_stats
totalMinutesPlayed | avgMinutesPlayed | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | totalFieldGoalsAttempted | avgFieldGoalsAttempted | avgFieldGoalPercentage | totalThreePointersMade | avgThreePointersMade | ... | avgTurnovers | sdTurnovers | totalFouls | avgFouls | sdFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
position | |||||||||||||||||||||
C | 68378 | 28.949196 | 10673 | 4.518628 | 3.193046 | 20468 | 8.665538 | 0.510869 | 888 | 0.375953 | ... | 1.537680 | 1.460354 | 6852 | 2.900931 | 1.469270 | 27607 | 11.687976 | 8.155494 | 0.124894 | 295 |
F | 157062 | 33.247671 | 26478 | 5.604996 | 3.478829 | 57994 | 12.276461 | 0.442891 | 6272 | 1.327688 | ... | 1.746613 | 1.619258 | 12717 | 2.691998 | 1.459660 | 72739 | 15.397756 | 9.419096 | 0.447290 | 2113 |
G | 158991 | 33.656012 | 27853 | 5.896063 | 3.533991 | 64220 | 13.594412 | 0.421273 | 9045 | 1.914691 | ... | 2.096105 | 1.707016 | 11916 | 2.522439 | 1.450330 | 78229 | 16.559907 | 9.663227 | 0.407917 | 1927 |
NaN | 174355 | 13.317675 | 23541 | 1.798121 | 2.000447 | 53933 | 4.119539 | 0.353511 | 7280 | 0.556065 | ... | 0.601436 | 0.886341 | 18385 | 1.404293 | 1.394553 | 64538 | 4.929575 | 5.355066 | -0.331118 | -4335 |
4 rows × 49 columns
By win/loss, all time.
regular_season_win_loss_all_time_summary_stats = regular_season_totals.groupby(["WL"]).agg(totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
regular_season_win_loss_all_time_summary_stats["totalFieldGoalsPercentage"] = regular_season_win_loss_all_time_summary_stats["totalFieldGoalsMade"]/ \
regular_season_win_loss_all_time_summary_stats["totalFieldGoalsAttempted"]
regular_season_win_loss_all_time_summary_stats["totalThreePointersPercentage"] = regular_season_win_loss_all_time_summary_stats["totalThreePointersMade"]/ \
regular_season_win_loss_all_time_summary_stats["totalThreePointersAttempted"]
regular_season_win_loss_all_time_summary_stats["totalFreeThrowsPercentage"] = regular_season_win_loss_all_time_summary_stats["totalFreeThrowsMade"]/ \
regular_season_win_loss_all_time_summary_stats["totalFreeThrowsAttempted"]
play_off_win_loss_all_time_summary_stats = play_off_totals.groupby(["WL"]).agg(totalFieldGoalsAttempted=("fieldGoalsAttempted","sum"),
avgFieldGoalsAttempted=("fieldGoalsAttempted","mean"),
totalFieldGoalsMade=("fieldGoalsMade","sum"),
avgFieldGoalsMade=("fieldGoalsMade","mean"),
sdFieldGoalsMade=("fieldGoalsMade","std"),
avgFieldGoalsPercentage=("fieldGoalsPercentage","mean"),
sdFieldGoalsPercentage=("fieldGoalsPercentage","std"),
totalThreePointersMade=("threePointersMade","sum"),
avgThreePointersMade=("threePointersMade","mean"),
sdThreePointersMade=("threePointersMade","std"),
totalThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersAttempted=("threePointersAttempted","sum"),
avgThreePointersPercentage=("threePointersPercentage","mean"),
sdThreePointersPercentage=("threePointersPercentage","std"),
totalFreeThrowsMade=("freeThrowsMade","sum"),
avgFreeThrowsMade=("freeThrowsMade","mean"),
sdFreeThrowsMade=("freeThrowsMade","std"),
totalFreeThrowsAttempted=("freeThrowsAttempted","sum"),
avgFreeThrowsAttempted=("freeThrowsAttempted","mean"),
avgFreeThrowsPercentage=("freeThrowsPercentage","mean"),
sdFreeThrowsPercentage=("freeThrowsPercentage","std"),
totalReboundsOffensive=("reboundsOffensive","sum"),
avgReboundsOffensive=("reboundsOffensive","mean"),
sdReboundsOffensive=("reboundsOffensive","std"),
totalReboundsDefensive=("reboundsDefensive","sum"),
avgReboundsDefensive=("reboundsDefensive","mean"),
sdReboundsDefensive=("reboundsDefensive","std"),
totalRebounds=("reboundsTotal","sum"),
avgRebounds=("reboundsTotal","mean"),
sdRebounds=("reboundsTotal","std"),
totalAssists=("assists","sum"),
avgAssists=("assists","mean"),
sdAssists=("assists","std"),
totalTurnovers=("turnovers","sum"),
avgTurnovers=("turnovers","mean"),
sdTurnovers=("turnovers","std"),
totalSteals=("steals","sum"),
avgSteals=("steals","mean"),
sdSteals=("steals","std"),
totalBlocks=("blocks","sum"),
avgBlocks=("blocks","mean"),
sdBlocks=("blocks","std"),
totalOpponentBlocks=("opponentBlocks","sum"),
avgOpponentBlocks=("opponentBlocks","mean"),
sdOpponentBlocks=("opponentBlocks","std"),
totalFouls=("foulsPersonal","sum"),
avgFouls=("foulsPersonal","mean"),
sdFouls=("foulsPersonal","std"),
totalDrawnFouls=("foulsPersonalDrawn","sum"),
avgDrawnFouls=("foulsPersonalDrawn","mean"),
sdDrawnFouls=("foulsPersonalDrawn","std"),
totalPoints=("points","sum"),
avgPoints=("points","mean"),
sdPoints=("points","std"),
avgPlusMinusPoints=("plusMinusPoints","mean"),
totalPlusMinusPoints=("plusMinusPoints","sum"))
play_off_win_loss_all_time_summary_stats["totalFieldGoalsPercentage"] = play_off_win_loss_all_time_summary_stats["totalFieldGoalsMade"]/ \
play_off_win_loss_all_time_summary_stats["totalFieldGoalsAttempted"]
play_off_win_loss_all_time_summary_stats["totalThreePointersPercentage"] = play_off_win_loss_all_time_summary_stats["totalThreePointersMade"]/ \
play_off_win_loss_all_time_summary_stats["totalThreePointersAttempted"]
play_off_win_loss_all_time_summary_stats["totalFreeThrowsPercentage"] = play_off_win_loss_all_time_summary_stats["totalFreeThrowsMade"]/ \
play_off_win_loss_all_time_summary_stats["totalFreeThrowsAttempted"]
regular_season_win_loss_all_time_summary_stats
totalFieldGoalsAttempted | avgFieldGoalsAttempted | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | avgFieldGoalsPercentage | sdFieldGoalsPercentage | totalThreePointersMade | avgThreePointersMade | sdThreePointersMade | ... | avgDrawnFouls | sdDrawnFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WL | |||||||||||||||||||||
L | 1432130 | 85.972506 | 622694 | 37.381078 | 4.956295 | 0.435454 | 0.048556 | 149694 | 8.986313 | 3.909025 | ... | 19.594249 | 4.113890 | 1671379 | 100.334914 | 12.324504 | -11.409233 | -190055 | 0.434803 | 0.327200 | 0.755713 |
W | 1421306 | 85.322728 | 688618 | 41.338576 | 5.095112 | 0.485391 | 0.050731 | 179130 | 10.753392 | 4.400842 | ... | 20.469684 | 4.427487 | 1861434 | 111.744147 | 12.337983 | 11.409233 | 190055 | 0.484497 | 0.389196 | 0.775990 |
2 rows × 59 columns
play_off_win_loss_all_time_summary_stats
totalFieldGoalsAttempted | avgFieldGoalsAttempted | totalFieldGoalsMade | avgFieldGoalsMade | sdFieldGoalsMade | avgFieldGoalsPercentage | sdFieldGoalsPercentage | totalThreePointersMade | avgThreePointersMade | sdThreePointersMade | ... | avgDrawnFouls | sdDrawnFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WL | |||||||||||||||||||||
L | 98300 | 83.234547 | 41798 | 35.392041 | 4.749084 | 0.426086 | 0.048997 | 10606 | 8.980525 | 3.801043 | ... | 20.678239 | 3.996580 | 114496 | 96.948349 | 11.738747 | -11.956816 | -14121 | 0.425209 | 0.319776 | 0.756900 |
W | 98315 | 83.247248 | 46747 | 39.582557 | 5.045488 | 0.476354 | 0.051971 | 12879 | 10.905165 | 4.435544 | ... | 21.548688 | 4.328311 | 128617 | 108.905165 | 12.060489 | 11.956816 | 14121 | 0.475482 | 0.383749 | 0.780628 |
2 rows × 59 columns
Advanced Summary Statistics¶
Advanced metrics for player and team-level analysis
#Team statistics to use to expand upon the player summary statistics
regular_season_team_stats = regular_season_team_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"})
regular_season_team_stats = regular_season_team_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]]
play_off_team_stats = play_off_team_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"})
play_off_team_stats = play_off_team_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]]
regular_season_team_all_time_stats = regular_season_team_all_time_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"})
regular_season_team_all_time_stats = regular_season_team_all_time_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]]
play_off_team_all_time_stats = play_off_team_all_time_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"})
play_off_team_all_time_stats = play_off_team_all_time_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]]
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[25], line 5 1 #Team statistics to use to expand upon the player summary statistics 3 regular_season_team_stats = regular_season_team_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"}) ----> 5 regular_season_team_stats = regular_season_team_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]] 7 play_off_team_stats = play_off_team_summary_stats.rename(columns={"totalMinutesPlayersPlayed":"teamMinutesPlayed","totalFreeThrowsAttempted":"teamFreeThrowsAttempted","totalFieldGoalsAttempted":"teamFieldGoalsAttempted","totalTurnovers":"teamTurnovers"}) 9 play_off_team_stats = play_off_team_stats[["teamMinutesPlayed","teamFreeThrowsAttempted","teamFieldGoalsAttempted","teamTurnovers"]] File ~/Library/Python/3.9/lib/python/site-packages/pandas/core/frame.py:4113, in DataFrame.__getitem__(self, key) 4111 if is_iterator(key): 4112 key = list(key) -> 4113 indexer = self.columns._get_indexer_strict(key, "columns")[1] 4115 # take() does not accept boolean indexers 4116 if getattr(indexer, "dtype", None) == bool: File ~/Library/Python/3.9/lib/python/site-packages/pandas/core/indexes/base.py:6212, in Index._get_indexer_strict(self, key, axis_name) 6209 else: 6210 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr) -> 6212 self._raise_if_missing(keyarr, indexer, axis_name) 6214 keyarr = self.take(indexer) 6215 if isinstance(key, Index): 6216 # GH 42790 - Preserve name from an Index File ~/Library/Python/3.9/lib/python/site-packages/pandas/core/indexes/base.py:6264, in Index._raise_if_missing(self, key, indexer, axis_name) 6261 raise KeyError(f"None of [{key}] are in the [{axis_name}]") 6263 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique()) -> 6264 raise KeyError(f"{not_found} not in index") KeyError: "['teamMinutesPlayed'] not in index"
regular_season_team_stats
totalWins | totalLosses | avgWins | avgLosses | totalMinutesPlayed | avgMinutesPlayed | teamFieldGoalsAttempted | avgFieldGoalsAttempted | totalFieldGoalsMade | avgFieldGoalsMade | ... | avgDrawnFouls | sdDrawnFouls | totalPoints | avgPoints | sdPoints | avgPlusMinusPoints | totalPlusMinusPoints | totalFieldGoalsPercentage | totalThreePointersPercentage | totalFreeThrowsPercentage | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
teamName | seasonYear | |||||||||||||||||||||
Atlanta Hawks | 2010-11 | 44 | 38 | 0.536585 | 0.463415 | 3946.0 | 48.121951 | 6429 | 78.402439 | 2971 | 36.231707 | ... | 18.500000 | 4.116363 | 7790 | 95.000000 | 11.177579 | -0.817073 | -67 | 0.462125 | 0.351787 | 0.778935 |
2011-12 | 40 | 26 | 0.606061 | 0.393939 | 3233.0 | 48.984848 | 5348 | 81.030303 | 2429 | 36.803030 | ... | 19.136364 | 5.409070 | 6375 | 96.590909 | 13.300060 | 3.439394 | 227 | 0.454188 | 0.369925 | 0.740072 | |
2012-13 | 44 | 38 | 0.536585 | 0.463415 | 3971.0 | 48.426829 | 6644 | 81.024390 | 3084 | 37.609756 | ... | 18.817073 | 3.859022 | 8032 | 97.951220 | 11.856032 | 0.402439 | 33 | 0.464178 | 0.371383 | 0.715256 | |
2013-14 | 38 | 44 | 0.463415 | 0.536585 | 3966.0 | 48.365854 | 6688 | 81.560976 | 3061 | 37.329268 | ... | 20.036585 | 4.281586 | 8282 | 101.000000 | 11.953614 | -0.475610 | -39 | 0.457685 | 0.362949 | 0.781145 | |
2014-15 | 60 | 22 | 0.731707 | 0.268293 | 3946.0 | 48.121951 | 6699 | 81.695122 | 3121 | 38.060976 | ... | 19.646341 | 4.395205 | 8409 | 102.548780 | 10.582016 | 5.426829 | 445 | 0.465890 | 0.380112 | 0.777522 | |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Washington Wizards | 2019-20 | 25 | 47 | 0.347222 | 0.652778 | 3471.0 | 48.208333 | 6544 | 90.888889 | 2990 | 41.527778 | ... | 22.236111 | 3.836419 | 8238 | 114.416667 | 13.035974 | -4.666667 | -336 | 0.456907 | 0.368443 | 0.787571 |
2020-21 | 34 | 38 | 0.472222 | 0.527778 | 3481.0 | 48.347222 | 6547 | 90.930556 | 3108 | 43.166667 | ... | 22.027778 | 4.168873 | 8398 | 116.638889 | 13.697235 | -1.833333 | -132 | 0.474721 | 0.351054 | 0.769108 | |
2021-22 | 35 | 47 | 0.426829 | 0.573171 | 3966.0 | 48.365854 | 7056 | 86.048780 | 3327 | 40.573171 | ... | 19.926829 | 4.221580 | 8907 | 108.621951 | 12.706215 | -3.378049 | -277 | 0.471514 | 0.342357 | 0.783465 | |
2022-23 | 35 | 47 | 0.426829 | 0.573171 | 3951.0 | 48.182927 | 7127 | 86.914634 | 3456 | 42.146341 | ... | 19.390244 | 3.519807 | 9279 | 113.158537 | 11.121628 | -1.207317 | -99 | 0.484917 | 0.355632 | 0.784548 | |
2023-24 | 15 | 67 | 0.182927 | 0.817073 | 3946.0 | 48.121951 | 7493 | 91.378049 | 3523 | 42.963415 | ... | 17.963415 | 3.762863 | 9327 | 113.743902 | 10.532502 | -9.292683 | -762 | 0.470172 | 0.348199 | 0.764031 |
420 rows × 65 columns
play_off_team_stats
teamMinutesPlayed | teamFreeThrowsAttempted | teamFieldGoalsAttempted | teamTurnovers | ||
---|---|---|---|---|---|
teamName | seasonYear | ||||
Atlanta Hawks | 2010-11 | 576.0 | 263 | 910 | 149 |
2011-12 | 293.0 | 97 | 476 | 92 | |
2012-13 | 288.0 | 157 | 464 | 73 | |
2013-14 | 336.0 | 174 | 551 | 95 | |
2014-15 | 778.0 | 311 | 1369 | 203 | |
... | ... | ... | ... | ... | ... |
Washington Wizards | 2013-14 | 533.0 | 250 | 877 | 141 |
2014-15 | 485.0 | 237 | 845 | 145 | |
2016-17 | 629.0 | 320 | 1139 | 179 | |
2017-18 | 288.0 | 140 | 511 | 81 | |
2020-21 | 240.0 | 145 | 443 | 67 |
224 rows × 4 columns
regular_season_team_all_time_stats
teamMinutesPlayed | teamFreeThrowsAttempted | teamFieldGoalsAttempted | teamTurnovers | |
---|---|---|---|---|
teamName | ||||
Atlanta Hawks | 53536.000 | 24394 | 94935 | 16048 |
Boston Celtics | 53763.000 | 23712 | 95241 | 15363 |
Brooklyn Nets | 53816.000 | 25406 | 94399 | 16156 |
Charlotte Hornets | 53430.000 | 25501 | 94312 | 14699 |
Chicago Bulls | 53505.000 | 23827 | 94646 | 15430 |
Cleveland Cavaliers | 53390.000 | 24875 | 93549 | 15707 |
Dallas Mavericks | 53940.000 | 24331 | 94777 | 14456 |
Denver Nuggets | 53793.985 | 26105 | 96239 | 16046 |
Detroit Pistons | 53468.000 | 25180 | 94878 | 15684 |
Golden State Warriors | 53345.000 | 23089 | 96183 | 16451 |
Houston Rockets | 53721.000 | 28285 | 95516 | 16723 |
Indiana Pacers | 53721.000 | 24650 | 95524 | 15765 |
Los Angeles Clippers | 53626.000 | 27445 | 93925 | 15460 |
Los Angeles Lakers | 53733.000 | 26784 | 95729 | 16236 |
Memphis Grizzlies | 53794.000 | 25021 | 95574 | 15489 |
Miami Heat | 53824.000 | 25441 | 91568 | 15795 |
Milwaukee Bucks | 53774.000 | 25111 | 95833 | 15918 |
Minnesota Timberwolves | 53362.000 | 27269 | 95291 | 16065 |
New Orleans Pelicans | 53751.000 | 25282 | 95205 | 15745 |
New York Knicks | 53458.000 | 24604 | 94722 | 15148 |
Oklahoma City Thunder | 53806.000 | 27285 | 96139 | 16178 |
Orlando Magic | 53749.000 | 23767 | 94824 | 15853 |
Philadelphia 76ers | 53793.985 | 25500 | 95131 | 16202 |
Phoenix Suns | 53754.000 | 25027 | 96298 | 16484 |
Portland Trail Blazers | 53832.000 | 24573 | 96380 | 15386 |
Sacramento Kings | 53741.000 | 25979 | 96151 | 16150 |
San Antonio Spurs | 53708.000 | 23742 | 95870 | 15024 |
Toronto Raptors | 53791.000 | 25746 | 95250 | 15049 |
Utah Jazz | 53736.000 | 25873 | 93239 | 16368 |
Washington Wizards | 53826.000 | 24941 | 96108 | 16077 |
play_off_team_all_time_stats
teamMinutesPlayed | teamFreeThrowsAttempted | teamFieldGoalsAttempted | teamTurnovers | |
---|---|---|---|---|
teamName | ||||
Atlanta Hawks | 4436.0 | 1969 | 7656 | 1235 |
Boston Celtics | 8566.0 | 3889 | 14601 | 2375 |
Brooklyn Nets | 2617.0 | 1263 | 4463 | 692 |
Charlotte Hornets | 528.0 | 268 | 864 | 126 |
Chicago Bulls | 3011.0 | 1320 | 5076 | 866 |
Cleveland Cavaliers | 4825.0 | 2320 | 8223 | 1293 |
Dallas Mavericks | 4618.0 | 2270 | 7856 | 1161 |
Denver Nuggets | 4840.0 | 2260 | 8617 | 1213 |
Detroit Pistons | 384.0 | 154 | 688 | 84 |
Golden State Warriors | 7682.0 | 3566 | 13711 | 2299 |
Houston Rockets | 4110.0 | 2277 | 7217 | 1230 |
Indiana Pacers | 4724.0 | 2209 | 7785 | 1384 |
Los Angeles Clippers | 5151.0 | 2773 | 8864 | 1360 |
Los Angeles Lakers | 3653.0 | 1789 | 6324 | 1020 |
Memphis Grizzlies | 4203.0 | 2182 | 7319 | 1066 |
Miami Heat | 8609.0 | 4181 | 14134 | 2302 |
Milwaukee Bucks | 4610.0 | 2107 | 8268 | 1266 |
Minnesota Timberwolves | 1589.0 | 803 | 2732 | 443 |
New Orleans Pelicans | 1445.0 | 655 | 2516 | 434 |
New York Knicks | 2506.0 | 1196 | 4323 | 680 |
Oklahoma City Thunder | 5772.0 | 3043 | 9846 | 1648 |
Orlando Magic | 1445.0 | 710 | 2456 | 428 |
Philadelphia 76ers | 4196.0 | 2151 | 7231 | 1155 |
Phoenix Suns | 2448.0 | 1049 | 4280 | 640 |
Portland Trail Blazers | 3319.0 | 1607 | 5942 | 899 |
Sacramento Kings | 336.0 | 180 | 669 | 99 |
San Antonio Spurs | 5287.0 | 2525 | 8976 | 1364 |
Toronto Raptors | 4466.0 | 2161 | 7641 | 1178 |
Utah Jazz | 2645.0 | 1338 | 4522 | 736 |
Washington Wizards | 2175.0 | 1092 | 3815 | 613 |
regular_season_player_summary_stats<-regular_season_box_scores|> filter(!grepl("DND|DNP|NWT",comment,ignore.case=TRUE))|> group_by(seasonYear,personName,teamName)|> summarise(totalMinutesPlayed=sum(minutes), avgMinutesPlayed=mean(minutes), totalFieldGoalsMade=sum(fieldGoalsMade), avgFieldGoalsMade=mean(fieldGoalsMade), sdFieldGoalsMade=sd(fieldGoalsMade), totalFieldGoalsAttempted=sum(fieldGoalsAttempted), avgFieldGoalsAttempted=mean(fieldGoalsAttempted), totalFieldGoalsPercentage=totalFieldGoalsMade/totalFieldGoalsAttempted, avgFieldGoalPercentage=mean(fieldGoalsPercentage), totalThreePointersMade=sum(threePointersMade), avgThreePointersMade=mean(threePointersMade), sdThreePointersMade=sd(threePointersMade), totalThreePointersAttempted=sum(threePointersAttempted), avgThreePointersAttempted=mean(threePointersAttempted), totalThreePointersPercentage=totalThreePointersMade/totalThreePointersAttempted, avgThreePointersPercentage=mean(threePointersPercentage), totalFreeThrowsAttempted=sum(freeThrowsAttempted), avgFreeThrowsAttempted=mean(freeThrowsAttempted), totalFreeThrowsMade=sum(freeThrowsMade), avgFreeThrowsMade=mean(freeThrowsMade), sdFreeThrowsMade=sd(freeThrowsMade), totalFreeThrowsPercentage=totalFreeThrowsMade/totalFreeThrowsAttempted, avgFreeThrowsPercentage=mean(freeThrowsPercentage), totalReboundsOffensive=sum(reboundsOffensive), avgReboundsOffensive=mean(reboundsOffensive), sdReboundsOffensive=sd(reboundsOffensive), totalReboundsDefensive=sum(reboundsDefensive), avgReboundsDefensive=mean(reboundsDefensive), sdReboundsDefensive=sd(reboundsDefensive), totalRebounds=sum(reboundsTotal), avgRebounds=mean(reboundsTotal), sdRebounds=sd(reboundsTotal), totalAssists=sum(assists), avgAssists=mean(assists), sdAssists=sd(assists), totalSteals=sum(steals), avgSteals=mean(steals), sdSteals=sd(steals), totalBlocks=sum(blocks), avgBlocks=mean(blocks), sdBlocks=sd(blocks), totalTurnovers=sum(turnovers), avgTurnovers=mean(turnovers), sdTurnovers=sd(turnovers), totalFouls=sum(foulsPersonal), avgFouls=mean(foulsPersonal), sdFouls=sd(foulsPersonal), totalPoints=sum(points), avgPoints=mean(points), sdPoints=sd(points), avgPlusMinusPoints=mean(plusMinusPoints), totalPlusMinusPoints=sum(plusMinusPoints))