Created
September 15, 2021 21:18
-
-
Save jackparmer/42702e47a793714f6b5bd6a96c7dc51d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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