MCPcopy Index your code
hub / github.com/Giyn/DataMiningVisualizationSystem / getDataSet

Function getDataSet

App/main.py:35–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34@app.route('/api-getDataSet', methods = ['POST', 'GET'])
35def getDataSet():
36
37 if request.method == 'POST':
38
39 data = json.loads(str(request.data, 'utf-8'))
40
41 path = ["MachineLearningAlgorithm/Bayes/spam_ham_dataset.csv",
42 "MachineLearningAlgorithm/KNN/tree.csv",
43 "MachineLearningAlgorithm/SupportVectorMachine/cancer.csv",
44 "MachineLearningAlgorithm/LinearRegression/housing.csv",
45 "MachineLearningAlgorithm/LogisticRegression/iris.csv",
46 "MachineLearningAlgorithm/ClassificationAndRegressionTree/forestfire1.csv"
47 ]
48
49 with open(path[data], 'r') as f:
50
51 text = StringIO(f.read())
52
53 df = read_csv(text, sep=',')
54
55 if ("Unnamed: 0" in df.columns): df = dropColumns(df, columns=["Unnamed: 0"])
56
57 res = DataFrame2Array(df)
58
59 return str(res)
60
61 return '<h1>请使用POST方法访问</h1>'
62
63@app.route('/api-DataFrame', methods = ['POST', 'GET'])
64def dataFrame() :

Callers

nothing calls this directly

Calls 2

dropColumnsFunction · 0.85
DataFrame2ArrayFunction · 0.85

Tested by

no test coverage detected