I am trying to get data from a csv and display it using dash table. I want to interact with one column and then changing another column accordingly (Subtracting value of ‘manual input’ column from ‘recommended’ column and storing the answer to ‘available’ column)
I have got the result of subtractions and can view the data frame on cmd but I do not understand how to write it to Output of Callback function and after trying following code it shows error loading dependencies.
DF= pd.read_csv(
‘data.csv’
)
app.layout = html.Div(children=[
html.H4(‘Manual recommendation’),
html.Div([
html.Div(id=‘Table’,children=
dt.DataTable(
rows=DF.to_dict(‘records’),
filterable=True,
sortable=True,
selected_row_indices=[],
id=‘edit-table’,
),
),
]),
],)
@app.callback(Output(‘edit-table’, ‘rows’),
[Input(‘edit-table’, ‘rows’)],
)
def update_table(rows):
df = pd.DataFrame(rows)
df[‘available’] = df[‘recommendation’].astype(int) - df[‘manual input’].astype(int)
return df