This file contains hidden or 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
| select * from cs621labexam1; | |
| --1 | |
| select * from cs621labexam1 where char_length(observer) > 9; | |
| --2 | |
| select * from cs621labexam1 | |
| where 1=1 | |
| and date_part('month', ts) = 01 | |
| and date_part('year', ts) = 2019 |
This file contains hidden or 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 | |
| import sqlalchemy | |
| # Create the engine to connect to a PostgreSQL database | |
| engine = sqlalchemy.create_engine('postgresql://aveek:test1234@localhost:5432/sql-shack-demo') | |
| # Read data from the SQL Table | |
| data = pd.read_csv('superstore.csv') | |
| # Print first few rows of the dataframe |
This file contains hidden or 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
| from flask import Flask | |
| from flask_restful import Api, Resource, reqparse | |
| import pandas as pd | |
| app = Flask(__name__) | |
| api = Api(app) | |
| class Users(Resource): | |
| def get(self): | |
| data = pd.read_csv('users.csv') |
This file contains hidden or 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
| from flask import Flask | |
| from flask_restful import Api, Resource, reqparse | |
| import pandas as pd | |
| app = Flask(__name__) | |
| api = Api(app) |
This file contains hidden or 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
| class Users(Resource): | |
| # Write method to fetch data from the CSV file | |
| def get(self): | |
| pass | |
| def post(self): | |
| # Write method to write data to the CSV file | |
| pass | |
| def delete(self): |
This file contains hidden or 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
| class Users(Resource): | |
| def get(self): | |
| data = pd.read_csv('users.csv') | |
| data = data.to_dict('records') | |
| return {'data' : data}, 200 | |
| def post(self): | |
| parser = reqparse.RequestParser() | |
| parser.add_argument('name', required=True) |
This file contains hidden or 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
| if __name__ == '__main__': | |
| app.run() |
This file contains hidden or 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
| from flask import Flask | |
| from flask_restful import Api, Resource, reqparse | |
| import pandas as pd | |
| app = Flask(__name__) | |
| api = Api(app) | |
| class Users(Resource): | |
| def get(self): | |
| data = pd.read_csv('users.csv') |
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 4 columns, instead of 5 in line 4.
This file contains hidden or 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
| order,product,qty,amount | |
| 1,car,2,5000 | |
| 2,bikes,1,2000 | |
| 3,cookies,10,80 | |
| 4,phone,1,5,300 |
This file contains hidden or 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
| # imports the JSON library to work in python | |
| import json | |
| # assign the JSON data to a variable | |
| json_data = """{ | |
| "data": [ | |
| { | |
| "type": "articles", | |
| "id": "1", | |
| "attributes": { |
OlderNewer