flex_subtitle = "built using jupyter-flex"
flex_external_link = "https://github.com/danielfrg/jupyter-flex/blob/master/examples/nba-scoring.ipynb"
flex_title = "NBA Scoring (2008)"
flex_orientation = "rows"
flex_show_source = True
import numpy as np
import pandas as pd
import plotly.graph_objects as go
url = "http://datasets.flowingdata.com/ppg2008.csv"
df = pd.read_csv(url)
df = df.rename(columns={"Name ": "Name"})
df = df.set_index("Name")
source = (df-df.mean())/df.std()
heatmap = go.Heatmap(x=source.columns, y=source.index, z=source, hoverongaps=False, colorscale='Viridis', showscale=False)
fig = go.FigureWidget(data=heatmap)
margin = go.layout.Margin(l=20, r=20, b=20, t=30)
fig.update_layout(margin=margin)
fig.show()
df.index.name = ""
df[["G", "MIN", "PTS"]].iloc[:20]