Skip to content

Instantly share code, notes, and snippets.

@jackparmer
Created September 15, 2021 21:18
Show Gist options
  • Save jackparmer/42702e47a793714f6b5bd6a96c7dc51d to your computer and use it in GitHub Desktop.
Save jackparmer/42702e47a793714f6b5bd6a96c7dc51d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
from jupyter_dash import JupyterDash
import dash
import dash_table as dt
import pandas as pd
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
df = pd.read_csv('https://git.io/Juf1t')
app = JupyterDash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container([
dbc.Label('Click a cell in the table:'),
dt.DataTable(
id='tbl', data=df.to_dict('records'),
columns=[{"name": i, "id": i} for i in df.columns],
),
dbc.Alert("Click the table", id='out'),
])
@app.callback(Output('out', 'children'), Input('tbl', 'active_cell'))
def update_graphs(active_cell):
return str(active_cell)
app.run_server(mode='inline')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment