I’ve got a table populating from a mysql db but the column headers are coming out as numbers 0,1,2,3, etc instead of the names they have. Any ideas on how to fix this anyone?
app = dash.Dash()
app.layout = html.Div([
dt.DataTable(
rows=[{}],
id='table'
),
dcc.Interval(id= 'graph-update',interval=10*1000),
])
@app.callback(
Output('table', 'rows'),
events=[Event('graph-update', 'interval')]
)
def gen_table():
conn = pymysql.connect()
query = ""
c = conn.cursor()
c.execute(query)
dh = pd.DataFrame([[ij for ij in i]for i in c])
return dh.to_dict('records')
if __name__ == '__main__':
app.run_server(debug=True)