title: Pandas Dataframe display on a webpage
body: <p>I am using Flask but this probably applies to a lot of similar frameworks.</p>
  
  <p>I construct a pandas Dataframe, e.g.</p>
  
  <pre><code>@app.route('/analysis/&lt;filename&gt;')
  def analysis(filename):
      x = pd.DataFrame(np.random.randn(20, 5))
      return render_template("analysis.html", name=filename, data=x)
  </code></pre>
  
  <p>The template analysis.html looks like</p>
  
  <pre><code>{% extends "base.html" %}
  {% block content %}
  &lt;h1&gt;{{name}}&lt;/h1&gt;
  {{data}}
  {% endblock %}
  </code></pre>
  
  <p>This works but the output looks horrible. It doesn't use linebreaks etc.
  I have played with <code>data.to_html()</code> and <code>data.to_string()</code>
  What's the easiest way to display a frame?</p>