Skip to content

Instantly share code, notes, and snippets.

@prabhant
Last active September 12, 2018 14:16
Show Gist options
  • Save prabhant/51671c70dfed1b9bb31744257547ee0b to your computer and use it in GitHub Desktop.
Save prabhant/51671c70dfed1b9bb31744257547ee0b to your computer and use it in GitHub Desktop.
app snippet 1
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
import pandas as pd
app = dash.Dash()
app.layout = html.Div([
html.H1('Please enter the input'),
dcc.Input(id='my-id', value='initial value', type='text'),
html.Div(id='my-div')
])
@app.callback(
Output(component_id='my-div', component_property='children'),
[Input(component_id='my-id', component_property='value')]
)
def update_output_div(input_value):
df = pd.read_csv('file.csv')
return df.iloc[input_value]
if __name__ == '__main__':
app.run_server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment