how to print a dataframe in flask website code example
Example: flask pandas dataframe to html table pdf
from flask import *
import pandas as pd
app = Flask(__name__)
@app.route("/tables")
def show_tables():
data = pd.read_excel('dummy_data.xlsx')
data.set_index(['Name'], inplace=True)
data.index.name=None
females = data.loc[data.Gender=='f']
males = data.loc[data.Gender=='m']
return render_template('view.html',tables=[females.to_html(classes='female'), males.to_html(classes='male')],
titles = ['na', 'Female surfers', 'Male surfers'])
if __name__ == "__main__":
app.run(debug=True)