Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jhconning/9e0b6cf4900a46e4400d3ee6c3b517b9 to your computer and use it in GitHub Desktop.
Save jhconning/9e0b6cf4900a46e4400d3ee6c3b517b9 to your computer and use it in GitHub Desktop.
read SQL into pandas with pymysql
import pandas as pd
import pymysql
mysql_connection = pymysql.connect(host='localhost',
user='root',
password='',
db='tutorfall2016',
charset='utf8',
cursorclass=pymysql.cursors.DictCursor)
sql = "SELECT * FROM `sign_ins`"
pd.read_sql(sql, mysql_connection, index_col='id')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment