Created
November 25, 2018 21:59
-
-
Save muthugit/983fe60b7b1421e9dc91f86252e1b34c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from flask import request | |
from flask import Flask | |
from flask_cors import CORS, cross_origin | |
app = Flask(__name__) | |
cors = CORS(app) | |
app.config['CORS_HEADERS'] = 'Content-Type' | |
df = pd.read_csv("data.csv") | |
@app.route("/2d") | |
@cross_origin() | |
def twod(): | |
x = request.args.get('x') | |
y = request.args.get('y') | |
requiredDf = df[[x,y]].copy() | |
requiredDf.columns=["dimensions","measure"] | |
json = requiredDf.to_json(orient='records') | |
return json | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment