Created
June 10, 2015 00:17
-
-
Save qiuwch/8ca02561d86de23f5310 to your computer and use it in GitHub Desktop.
Python script for connecting to database
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
| %pylab inline | |
| import pandas as pd | |
| import sqlite3 | |
| con = sqlite3.connect("../Project_202a/yelp.db") | |
| df = pd.read_sql(“select * from xx", con) | |
| import MySQLdb | |
| import pandas as pd | |
| db = MySQLdb.connect(host="localhost", # your host, usually localhost | |
| user="root", # your username | |
| passwd="", # your password | |
| db="iiq") # name of the data base | |
| pd.read_sql("SELECT * FROM levels", db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment