Last active
June 1, 2017 13:55
-
-
Save atandy/5a763046ddb3188e36e3 to your computer and use it in GitHub Desktop.
Rendering CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HTML> | |
<body> | |
{{table}} | |
</body> | |
</HTML> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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