title: Return a Pandas DataFrame as a data_table from a callback with Plotly Dash for Python
body: <p>I would like to read a .csv file and return a groupby function as a callback to be displayed as a simple data table with "dash_table" library. @Lawliet's helpful answer shows how to do that with "dash_table_experiments" library. Here is where I’m stuck:</p>
  
  <pre><code>import pandas as pd
  import dash
  import dash_core_components as dcc
  import dash_html_components as html
  import dash_table
  from dash.dependencies import Input, Output, State
  
  df = pd.read_csv(
          'https://gist.githubusercontent.com/chriddyp/'
          'c78bf172206ce24f77d6363a2d754b59/raw/'
          'c353e8ef842413cae56ae3920b8fd78468aa4cb2/'
          'usa-agricultural-exports-2011.csv')
  
  app = dash.Dash()
  application = app.server
  
  app.layout = html.Div([
      dash_table.DataTable(
          id = 'datatable',        
      ),
  
      html.Div([
          html.Button(id='submit-button',                
                  children='Submit'
      )
      ]),    
  
  ])
  
  @app.callback(Output('datatable','data'),
              [Input('submit-button','n_clicks')],
                  [State('submit-button','n_clicks')])
  
  def update_datatable(n_clicks,csv_file):            
      if n_clicks:                            
          dfgb = df.groupby(['state']).sum()
          return dfgb.to_dict('rows')
  
  if __name__ == '__main__':
      application.run(debug=False, port=8080)
  </code></pre>