title: How to convert html_Table to pandas dataframe in Dash using python?
body: <p>I have a pandas dataframe in Dash which is converted to HTML before being returned to html.Div() using the below function -</p>
  <pre><code>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))]
      )
  </code></pre>
  <p>This will again be an Input in a callback, where I need to convert the html table to a dataframe to allow me to perform calculations on its columns. I have tried this - [did not help though]</p>
  <pre><code>@app.callback(
      [Output(&quot;newtable&quot;, &quot;children&quot;)],
      [Input(&quot;mastertable&quot;, &quot;children&quot;),
       ])
  def performcalc(x):
      if not x is None:
          tb = pd.read_html(str([x])) # this is not working
          ## Perfomr calculations on dataframe ##
          return [tb]
      return None
  
  </code></pre>
  <p>How can I convert the html input to a pandas dataframe?</p>
  <p>Also, last row of the table is going to be an summary row, that is, sum of the respective columns. I would like to pass a line separating the values from the summary row when I return it to the Div. Something like this -</p>
  <pre><code>Col1  Col2  Col3
   1     2     3
   3     2     1
  ----------------
   4     4     4
  </code></pre>
  <p>Thank you for your help is advance.</p>