Hi,
I have a dropdown and two input fields and a button. when user click the button they will be added to the dataframe for later use. now i had to define a global dataframe and each time user push the button i update that and show it as html table . but in this manner the app can not serve multiple users and the dataframe is available for all users. how can i get these data and store them ?
columns = ['name', 'class', 'odd', 'config']
df = pd.DataFrame(columns=columns)
@app.callback(
Output('_table', 'children'),
[Input('_add', 'n_clicks')],
[State('_name', 'value'),
State('_config', 'value'),
State('_dropdown', 'value')]
)
def _add_table(click, name, config, dropdown):
df_data = [_name , _dropdown, _config*2, _config]
df.loc[df.shape[0]+1] = df_data
return html.Table(
# Header
[html.Tr([html.Th(col) for col in df.columns])] +
# Body
[html.Tr([
html.Td(df.iloc[i][col]) for col in df.columns
]) for i in range(df.shape[0])]
)