Skip to content

Instantly share code, notes, and snippets.

@jackparmer
Created September 15, 2021 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackparmer/1c2efd206c094ab96608299c920c103d to your computer and use it in GitHub Desktop.
Save jackparmer/1c2efd206c094ab96608299c920c103d to your computer and use it in GitHub Desktop.
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)
if __name__ == "__main__":
app.run_server(host='0.0.0.0', port=5000, debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment