Hi All,
I am using below example to upload the file and generate table
https://github.com/plotly/dash-core-components/pull/73
uploading component is working fine but it is not generating the table.
layout_page_5 = html.Div([
html.Div(id='waitfor'),
dcc.Upload(
id='upload',
children=html.Div([
'Drag and Drop or ',
html.A('Select a File')
]),
style={
'width': '100%',
'height': '60px',
'lineHeight': '60px',
'borderWidth': '1px',
'borderStyle': 'dashed',
'borderRadius': '5px',
'textAlign': 'center',
'margin': '10px'
}
),
html.Div(id='output'),
html.Div(dt.DataTable(rows=[{}]), style={'display': 'none'}),
html.Br(),
dcc.Link('Navigate to "/"', href='/'),
html.Br(),
dcc.Link('Navigate to Bar-charts for Categorical Variable', href='/Bar-charts'),
html.Br(),
dcc.Link('Navigate to Histogram-charts for Continuous Variable', href='/Histogram-charts'),
html.Br(),
dcc.Link('Navigate to Scatter-plots b/w Target Variable & Continuous Variables', href='/Scatter-charts'),
html.Br(),
dcc.Link('Navigate to Histogram-charts for Target Variable & Categorical Variables', href='/Histocat-charts'),
])
@app.callback(Output('output', 'children'),
[Input('upload', 'contents')])
def update_output(contents):
if contents is not None:
content_type, content_string = contents.split(',')
if 'csv' in content_type:
df = pd.read_csv(io.StringIO(base64.b64decode(content_string).decode('utf-8')))
return html.Div([
dt.DataTable(rows=df.to_dict('records'))
])
Please help