Skip to content

Instantly share code, notes, and snippets.

@chrishowes
Created April 13, 2014 17:30
Show Gist options
  • Save chrishowes/10593783 to your computer and use it in GitHub Desktop.
Save chrishowes/10593783 to your computer and use it in GitHub Desktop.
MySQL to Pandas DataFrame
import pandas as pd
import MySQLdb
db_conn = MySQLdb.connect(host="HOST", user="USER", passwd="PW", db="DATABASE")
sql_str = "SELECT field FROM table"
df = pdb.io.sql.read_frame(sql_str, db_conn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment