Created
August 13, 2018 15:01
-
-
Save MLKrisJohnson/86942cf1d7b19ba4fe7f6187fc82c256 to your computer and use it in GitHub Desktop.
Example of connecting to a PostgreSQL database and getting a Pandas DataFrame for a table
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 psycopg2 as pg | |
import pandas as pd | |
conn = pg.connect(database="mydatabase", | |
user="myuser", | |
password="mypassword") | |
df = pd.read_sql('select * from event', conn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment