Lab work 2.

This commit is contained in:
ElEgEv 2023-09-28 15:14:37 +04:00
parent 7b1862cfba
commit 55e6165fa0
3 changed files with 21 additions and 3 deletions

View File

@ -14,7 +14,7 @@ countNull = listShops.isnull().sum()
@app.route("/")
def home():
return render_template('main_page.html', context=[], listTypes=listTypes, countNull=countNull, firstColumn=1, secondColumn=4)
return render_template('main_page.html', context=[], listTypes=listTypes, countNull=countNull, firstRow=1, secondRow=4, firstColumn=1, secondColumn=4)
@app.route("/showDiapason", methods=['GET','POST'])
def numtext():
@ -56,7 +56,22 @@ def numtext():
firstColumn=int(data['firstColumn']), secondColumn=int(data['secondColumn']),
firstRow=int(data['firstRow']), secondRow=int(data['secondRow']))
home()
return home()
#функция для проведения анализа данных
@app.route("/analysis", methods=['GET', 'POST'])
def analysis():
roundedListShops = listShops
for data in roundedListShops.items():
roundedListShops.loc[data[0], 'Store_Area'] = (data[1].astype("Int64")/100)*100
#groupingByArea = listShops.groupby(['Store_Area']/100*100).agg({'Items_Available': ['mean']})
print(roundedListShops)
return home()
if __name__=="__main__":
app.run(debug=True)

View File

@ -20,6 +20,9 @@
<input type=text size=20 name=secondColumn>
<input type=submit value='Вывод диапазона'>
</form>
<form action='http://127.0.0.1:5000/analysis' method=get>
<input type=submit value='Анализ данных'>
</form>
</div>
<div>
<table>

View File

@ -1,4 +1,4 @@
Store_ID ,Store_Area,Items_Available,Daily_Customer_Count,Store_Sales
Store_ID,Store_Area,Items_Available,Daily_Customer_Count,Store_Sales
1,1659,1961,530,66490
2,1461,1752,210,39820
3,1340,1609,720,54010

1 Store_ID Store_ID Store_Area Items_Available Daily_Customer_Count Store_Sales
2 1 1659 1961 530 66490
3 2 1461 1752 210 39820
4 3 1340 1609 720 54010