Code
import polars as pl
from great_tables import GT, md
# Data prep
draft = (pl.read_csv('https://raw.githubusercontent.com/fivethirtyeight/data/master/nba-draft-2015/historical_projections.csv')
.insert_column(index=0, column=pl.Series(name="Rank", values=range(1, 1091)))
.filter(pl.col('Draft Year')==2015)
.filter(pl.col('Rank')<=16)
.drop(['ID','Draft Year'])
)
# Great Table
table = (
GT(draft)
.tab_header(
title = md("# Top College Prospects for the 2015 NBA Draft"),
subtitle= "Ranked by 538's projected Statistical Plus/Minus (SPM)"
)
.tab_spanner(
label="Probability of becoming",
columns=['Projected SPM',
'Superstar',
'Starter',
'Role Player',
'Bust']
)
.tab_source_note(md(
'<br><div style="text-align: left;">'
"**#30DayChartChallenge** | Day 30 | 538"
"<br> **Source**: https://fivethirtyeight.com/features/projecting-the-top-50-players-in-the-2015-nba-draft-class/"
"<br> **Made by**: www.ddanieltan.com"
"</div>"
"<br>"
))
.fmt_number(columns='Projected SPM', decimals=2, pattern='+{x}')
.fmt_percent(columns=['Superstar','Starter','Role Player','Bust'])
.data_color(columns="Superstar",palette=["lightblue", "darkgreen"]
)
.data_color(columns="Bust", palette=["lightyellow","pink",]
)
.fmt_nanoplot(columns="Projected SPM", plot_type="bar")
)
table
Top College Prospects for the 2015 NBA Draft |
|||||||
---|---|---|---|---|---|---|---|
Ranked by 538's projected Statistical Plus/Minus (SPM) | |||||||
Rank | Player | Position | Probability of becoming | ||||
Projected SPM | Superstar | Starter | Role Player | Bust | |||
1 | Karl-Anthony Towns | C | 13.48% | 42.72% | 16.31% | 27.50% | |
2 | Justise Winslow | SF | 8.35% | 51.09% | 17.68% | 22.88% | |
3 | Stanley Johnson | SF | 6.78% | 42.37% | 27.85% | 23.00% | |
4 | Jahlil Okafor | C | 5.87% | 40.99% | 23.55% | 29.59% | |
5 | D`Angelo Russell | PG | 15.20% | 34.23% | 9.66% | 40.91% | |
6 | Dakari Johnson | C | 2.13% | 36.75% | 41.76% | 19.35% | |
7 | Devin Booker | SG | 7.34% | 32.45% | 39.02% | 21.20% | |
8 | Willie Cauley-Stein | C | 4.71% | 40.60% | 24.32% | 30.37% | |
9 | Rondae Hollis-Jefferson | SF | 1.46% | 36.85% | 39.25% | 22.44% | |
10 | Trey Lyles | PF | 2.24% | 35.13% | 40.31% | 22.32% | |
11 | Sam Dekker | SF | 0.87% | 38.50% | 32.91% | 27.73% | |
12 | Kelly Oubre Jr. | SF | 1.98% | 37.90% | 33.80% | 26.32% | |
13 | Tyus Jones | PG | 2.72% | 41.46% | 28.44% | 27.38% | |
14 | Kevon Looney | PF | 0.83% | 35.56% | 37.49% | 26.12% | |
15 | Myles Turner | PF | 2.94% | 33.58% | 31.85% | 31.63% | |
16 | Cliff Alexander | PF | 0.76% | 29.48% | 40.66% | 29.10% | |
#30DayChartChallenge | Day 30 | 538
Source: https://fivethirtyeight.com/features/projecting-the-top-50-players-in-the-2015-nba-draft-class/ Made by: www.ddanieltan.com |