Georgios Karamanis |||

NBA games that ended with the same score on the same day

Yesterday, during Round of 16 of the FIBA EuroBasket 2022, three matches ended with the same score, 94-86.

[

](

)

I wanted to see if this has happened before in the tournament. I couldn’t find a data set and scraping the results wasn’t as straightforward as I thought. So, I turned to NBA instead.

I downloaded the Basketball Dataset from Kaggle, that contains data on every game since the first NBA season in 1946-47.

The data set is actually an SQLite database, so I used the RSQLite package to read the file and get a list of the tables:

library(RSQLite)

library(tidyverse)

con <- dbConnect(drv = RSQLite::SQLite(), dbname = "nba.sqlite")

tables <- dbListTables(con)

tables <- tables[tables != "sqlite_sequence"]

There are 16 tables, the one with the game results is Game

tables

 [1] "Draft"                 "Draft_Combine"         "Game"                 

 [4] "Game_Inactive_Players" "Game_Officials"        "News"                 

 [7] "News_Missing"          "Player"                "Player_Attributes"    

[10] "Player_Bios"           "Player_Photos"         "Player_Salary"        

[13] "Team"                  "Team_Attributes"       "Team_History"         

[16] "Team_Salary" 

The next step was to get just the Game table:

games <- dbGetQuery(conn=con, statement=paste("SELECT * FROM 'Game'", sep=""))

I cleaned the variable names and selected the columns of interest, then remove duplicate rows:

scores <- games %>% 

  janitor::clean_names() %>% 

  select(game_id, game_date, team_name_home, team_name_away, pts_home, pts_away) %>% 

  distinct()

In order to count the same scores for each date, I created a new column with each game’s score as a sorted list. That means that two games that ended, for example, with 86-64 and 64-86, appear in the same way, as c(86, 64).

The final step was to add a count of scores by date and sort it:

score_counts <- scores %>% 

  rowwise() %>% 

  mutate(score = list(sort(c(pts_home, pts_away)))) %>% 

  ungroup() %>% 

  add_count(game_date, score, sort = TRUE)

It looks like that the same score has appeared three times on the same day only once, on March 5, 2003. That’s one date of the 11,015 dates in the database. If we consider only dates with three or more games, it is 1 in 9,079, or 0.01%.

Up next TidyTuesday 2022/36 TidyTuesday 2022/37
Latest posts TidyTuesday 2024/46 TidyTuesday 2024/45 TidyTuesday 2024/44 TidyTuesday 2024/43 TidyTuesday 2024/42 TidyTuesday 2024/41 TidyTuesday 2024/40 TidyTuesday 2024/39 TidyTuesday 2024/38 TidyTuesday 2024/37 TidyTuesday 2024/36 TidyTuesday 2024/35 TidyTuesday 2024/34 TidyTuesday 2024/33 TidyTuesday 2024/32 TidyTuesday 2024/31 TidyTuesday 2024/30 TidyTuesday 2024/29 TidyTuesday 2024/28 TidyTuesday 2024/27 TidyTuesday 2024/26 TidyTuesday 2024/25 TidyTuesday 2024/24 TidyTuesday 2024/23 TidyTuesday 2024/22 TidyTuesday 2024/21 TidyTuesday 2024/20 TidyTuesday 2024/19 TidyTuesday 2024/18 30DayChartChallenge 2024 TidyTuesday 2024/17