-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_flask
More file actions
58 lines (40 loc) · 1.37 KB
/
api_flask
File metadata and controls
58 lines (40 loc) · 1.37 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
from flask import Flask
from flask_restful import Api,Resource
app = Flask(__name__)
api = Api(app)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
@app.route("/sum/<int:a>,<int:b>")
def sum1(a,b):
return str(a+b)
@app.route("/avg/<int:a>,<int:b>")
def avg1(a,b):
return str((a+b)/2)
if __name__=="__main__":
app.run(debug=True)
https://www.youtube.com/watch?v=GMppyAPbLYk
*********************************************************
import pandas as pd
#stat=mean
#col=coloumn_name
col="one"
class CSV_data():
def __init__(self):
df = pd.read_csv (r'student.csv')
def data_col_mean(self):
m1 = df['col'].mean()
df['Diff-Mean']=[(x-int(m1)) for x in df.col]
print ('Mean Marks: ' + str(m1))
print ('avgMeandiff Marks: ' + str(df['Diff-Mean'].median()))
print ('Min Meandiff Marks: ' + str(df['Diff-Mean'].min()))
print ('Max Meandiff Marks: ' + str(df['Diff-Mean'].max()))
def data_col_median(self):
m2 = df['col'].median()
df['Diff-Median']=[(x-int(m2)) for x in df.col]
print ('avgMediandiff Marks: ' + str(df['Diff-Median'].median()))
print ('Min Mediandiff Marks: ' + str(df['Diff-Median'].min()))
print ('Max Mediandiff Marks: ' + str(df['Diff-Median'].max()))
c=CSV_data()
print(c.df(head))
**************************************************************************8