🚀 Gen 5 of the leading AI app deployment platform launches October 6. Click for the livestream.

Update a DataTable by creating a dataframe in a callback function

Hi, I’m trying to simply output a dataframe to a dash_table from a callback function. If anyone can point me to an example of this I would appreciate it. I’ve looked through a lot of examples on the forum already but they solve the problem for “dash_table_experiments” which is different. Here is an example I cribbed from one of those topis which is not working.


import dash
from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc
import dash_table
import pandas as pd

app = dash.Dash()

df = pd.DataFrame({‘x’: [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’],‘y’: [4, 3, 1, 2, 3, 6],‘z’: [‘z’, ‘b’, ‘c’, ‘a’, ‘b’, ‘c’]})

app.layout = html.Div([

@app.callback(Output(‘table’, ‘data’))
def update_info_table():
columns=[{“name”: i, “id”: i} for i in df.columns]
return columns,data

if name == ‘main’:

TypeError: Unexpected keyword argument rows

1 Like

It looks like this one this one answers my question actually.