NBA Outside the Box

date published : March 20, 2021

What is Outside the Box?

Outside the Box is where I keep my NBA-related thoughts.


I am eager to include more posts on this blog, but right now you can find some fun content like this:

At what age to NBA players score the most points? fig1-1

What NBA players have the best +/- box score? fig2-1

What NBA teams have the largest height difference between players? hist2

And, you can find more serious content about querying and visualizaing data like this:

def display_data():
    master_list = []
    for team in Teams():
        print('=' * 80)
        print(team.name)
        team_heights = {}
        for player in team.roster.players:
            height = get_height_in_inches(player.height)
            team_heights[player.name] = height
        height_diff = print_players(team_heights)
        master_list.append([team.name, height_diff])
    print(master_list)
    return master_list
theme_set(theme_minimal())
ggplot(s2017, aes(x=net_rating, y=player_name, col = ifelse(net_rating > avg,'above average','below average'))) +
  geom_point() + 
  geom_smooth(method=lm, se=FALSE) +
  theme(legend.position="right") + 
  labs(subtitle="Net (+/-) of NBA players scoring more than 20 points per game", 
       y="Player Name", 
       x="Net Rating (+/-)",
       col="Avg rating ~= 4.4",
       title="Scatterplot", 
       caption = "Source: nba")