Skip to content

Instantly share code, notes, and snippets.

View 00krishna's full-sized avatar

Krishna Bhogaonker 00krishna

  • Student, UCLA
  • Los Angeles, CA, USA
View GitHub Profile
@00krishna
00krishna / pandas.postgres.py
Last active March 21, 2022 13:44
Connect from python pandas to a postgresql database and pull data.
import psycopg2 as pg
import pandas.io.sql as psql
# get connected to the database
connection = pg.connect("dbname=mydatabase user=postgres")
dataframe = psql.frame_query("SELECT * FROM <tablename>", connection)
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
@00krishna
00krishna / 0_reuse_code.js
Created February 15, 2014 22:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console