Skip to content

Instantly share code, notes, and snippets.

View draperjames's full-sized avatar

James Draper draperjames

View GitHub Profile
@draperjames
draperjames / pandas_dbms.py
Created May 10, 2017 20:33 — forked from catawbasam/pandas_dbms.py
Python PANDAS : load and save Dataframes to sqlite, MySQL, Oracle, Postgres
# -*- 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,
@draperjames
draperjames / easy_bokeh_display.py
Last active January 11, 2017 15:32
easy bokeh display in jupyter notebook
%env BOKEH_RESOURCES=inline ipython notebook
from bokeh.io import show, output_notebook
from bokeh.plotting import ColumnDataSource, figure
from bokeh.models import HoverTool, Range1d
output_notebook()
fig = figure(tools=[HoverTool(tooltips=[("html", "@html{safe}")])])
fig.quad(left="left", top="top", bottom="bottom", right="right",
source=ColumnDataSource({"left": [1,3], "bottom": [1,3],
@draperjames
draperjames / multiRegExOr.py
Last active May 22, 2017 14:02
lil python function for "OR"ed regex terms from a given list.
def multiRegExOr(term_list):
"""Returns a singles string of "OR"ed regex terms from a given list.
Parameters
----------
term_list: list
List of regular expressions.
Returns
-------
@draperjames
draperjames / DataFrameGUI.py
Created November 17, 2016 21:56 — forked from jsexauer/DataFrameGUI.py
A sophisticated GUI to interact with DataFrame objects
"""
DataFrameTable
==============
Quick and Dirty Qt app to view pandas DataFrames. Includes sorting and
filterting.
Based on qtpandas in pandas sandbox module, by Jev Kuznetsov
Usage: