Skip to content

Instantly share code, notes, and snippets.

@atandy
Last active June 1, 2017 13:55
Show Gist options
  • Save atandy/5a763046ddb3188e36e3 to your computer and use it in GitHub Desktop.
Save atandy/5a763046ddb3188e36e3 to your computer and use it in GitHub Desktop.
Rendering CSV
<HTML>
<body>
{{table}}
</body>
</HTML>
from flask import Flask, render_template, url_for, request
import pandas as pd
app = Flask(__name__, static_url_path='/static')
@app.route("/")
def index():
df = pd.read_csv('name_of_csv_file.csv')
html = df.to_html()
return render_template('index.html', table=html)
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True, port=8000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment