-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.py
44 lines (32 loc) · 1020 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('ignore')
from matplotlib import colors as plt_colors
import matplotlib.pyplot as plt
from flask import Flask, render_template, redirect, url_for,request
from flask import make_response
app = Flask(__name__)
@app.route("/")
def home():
return "hi"
@app.route("/index")
@app.route('/getdata', methods=['GET', 'POST'])
def login():
message = None
if request.method == 'POST':
filename = request.form['mydata']
data = pd.read_excel(filename,sheet_name=1)
reduce_by = 2
data = data.groupby(data.index//reduce_by,as_index=False).first()
result = data.to_json()
result = "return this"
resp = make_response('{"response": '+result+'}')
resp.headers['Content-Type'] = "application/json"
return resp
return render_template('login.html', message='')
if __name__ == "__main__":
app.run(debug = True)