title: Converting html to dict using pandas
body: <p>I am trying to convert an HTML table into a dictionary using pandas.
  I am extracting the HTML with beautiful soup and stared in the <strong>tables</strong> variable.</p>
  <p><strong>This is what the DataFrame looks like:</strong></p>
  <pre><code>   Date        Value
  0  2019          31
  1  2018          11
  2  2017          11
  3  2016          10
  4  2015          99
  5  2014          98
  </code></pre>
  <p><strong>This is what I am doing</strong></p>
  <pre><code> df = pd.read_html(str(tables), flavor='lxml')[0]
   final = df.to_dict(orient='index')
   return final
  </code></pre>
  <p><strong>And this is my result</strong></p>
  <pre><code>  &quot;0&quot;: {
      &quot;Date&quot;: &quot;2019&quot;,
      &quot;Value&quot;: &quot;31&quot;
    },
    &quot;1&quot;: {
      &quot;Date&quot;: &quot;2018&quot;,
      &quot;Value&quot;: &quot;11&quot;
    },
    &quot;2&quot;: {
      &quot;Date&quot;: &quot;2017&quot;,
      &quot;Value&quot;: &quot;11&quot;
    },
    &quot;3&quot;: {
      &quot;Date&quot;: &quot;2016&quot;,
      &quot;Value&quot;: &quot;10&quot;
    },
    &quot;4&quot;: {
      &quot;Date&quot;: &quot;2015&quot;,
      &quot;Value&quot;: &quot;99&quot;
    },
    &quot;5&quot;: {
      &quot;Date&quot;: &quot;2014&quot;,
      &quot;Value&quot;: &quot;98&quot;
    }
  }
  </code></pre>
  <p><strong>I am looking for output like this:</strong></p>
  <pre><code>&quot;Values&quot; : [ 
                  { &quot;Date&quot;:  &quot;2019&quot;,
                     &quot;value&quot; : &quot;31&quot;
                  },
                  { &quot;Date&quot;:  &quot;2018&quot;,
                     &quot;value&quot; : &quot;11&quot;
                  },
                  { &quot;Date&quot;:  &quot;2017&quot;,
                     &quot;value&quot; : &quot;11&quot;
                    },
                    { &quot;Date&quot;:  &quot;2016&quot;,
                      &quot;value&quot; : &quot;10&quot;
                    },
                    { &quot;Date&quot;:  &quot;2015&quot;,
                      &quot;value&quot; : &quot;99&quot;
                    },
                    { &quot;Date&quot;:  &quot;2014&quot;,
                      &quot;value&quot; : &quot;98&quot;
                    }
                  ]
   
  
  
  
  </code></pre>