When I try to output raw values like True/False I get a strange error saying ‘Error loading dependencies’.
The solution is very simple encode the values to string but the error should be improved as I had to guess what was causing it.
Please see the code needed to replicate error:
Try this:
def load_data():
return pd.DataFrame({“A” : [1,2,3,4], “B” : [True,False,True,False]})
def generate_table(dataframe, max_rows=10):
return html.Table(
# Header
[html.Tr([html.Th(col) for col in dataframe.columns])] +
# Body
[html.Tr([
html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
]) for i in range(min(len(dataframe), max_rows))]
)
app = dash.Dash()
app.layout = html.Div(children=[
html.H4(children='US Agriculture Exports (2011)'),
generate_table(load_data())
])
if __name__ == '__main__':
app.run_server(debug=True,port=777)