Created
September 15, 2021 21:16
-
-
Save jackparmer/1c2efd206c094ab96608299c920c103d 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) | |
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