'I want to make a place to search, give it a name from column: No client And it gives you lignes in which there is a name pandas and flask

I want to make a place to search, give it a name from column: No client And it gives you lignes in which there is a name. df is dataframe--and clint.csv is name file csv mdf filter of the column

python

from flask import Flask, request, render_template, session, redirect
import numpy as np
import pandas as pd


app = Flask(__name__)

#df is dataframe--and clint.csv is name file csv
df=pd.read_csv('client.csv', sep = ';')

#mdf filter of the column 
mdf=pd.DataFrame(data = df, columns = ['Nom client livraison','Adresse de livraison', 
'Ville livraison', 'Nom client facturation'])


@app.route('/', methods=("POST", "GET"))
def html_table():

    return render_template('tabel.html',  tables=[mdf.to_html(classes='data')], 
    titles=mdf.columns.values)



if __name__ == '__main__':
    app.run()

html templates

#code html 
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

{% for table in tables %}
            {{titles[loop.index]}}
            {{ table|safe }}
{% endfor %}
</body>
</html>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source