In [ ]:
flex_title = "NBA Scoring (2008)"
flex_orientation = "rows"
flex_source_code = "https://github.com/danielfrg/jupyter-flex/blob/master/examples/nba-scoring.ipynb"
In [ ]:
import numpy as np
import pandas as pd

import plotly.graph_objects as go
In [ ]:
url = "http://datasets.flowingdata.com/ppg2008.csv"
df = pd.read_csv(url)
In [ ]:
df = df.rename(columns={"Name  ": "Name"})
In [ ]:
df = df.set_index("Name")

Heatmap

In [ ]:
source = (df-df.mean())/df.std()
In [ ]:
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()

Table

In [ ]:
df.index.name = ""
df[["G", "MIN", "PTS"]].iloc[:20]
In [ ]: