Skip to content

Instantly share code, notes, and snippets.

View wesm's full-sized avatar
💭
➡️ ➡️ ➡️

Wes McKinney wesm

💭
➡️ ➡️ ➡️
View GitHub Profile
@wesm
wesm / gist:1079577
Created July 13, 2011 01:50
Summarizing an Interactive Brokers activity statement
"""
A little script for summarizing my Interactive Broker statements
"""
from pandas import *
from pandas.util.testing import set_trace as st
import numpy as np
from BeautifulSoup import BeautifulSoup
@wesm
wesm / git_code_churn.py
Created September 8, 2011 03:02
Little script to get a time series of code churn (insertions, deletions) on a git repo
from dateutil import parser
import subprocess
import os
import re
import sys
import numpy as np
from pandas import *
@wesm
wesm / gist:1252447
Created September 30, 2011 01:44
AST magic to read variable names from prior stack frame
from pandas.util.testing import set_trace
import pandas.util.testing as tm
from pandas import *
import ast
import inspect
import sys
def merge(a, b):
f, args, _ = parse_stmt(inspect.currentframe().f_back)
@wesm
wesm / lightning.txt
Created October 7, 2011 14:31 — forked from pycodeconf/lightning.txt
PyCodeConf 2011 Lightning Talk Signup
I want to give a lightning talk about: pandas (http://pandas.sourceforge.net)
I need the projector: yes
@wesm
wesm / gist:1498531
Created December 19, 2011 19:34
qwt/PyQwt dependencies for procexp in Linux
svn co https://qwt.svn.sourceforge.net/svnroot/qwt/branches/qwt-5.2
cd qwt-5.2
qmake
make
sudo make install
now you're done with qwt
@wesm
wesm / function_lengths.py
Created January 8, 2012 22:34
Count all function lengths under a directory
from pandas import DataFrame
from pandas.util.testing import set_trace
import os
import numpy as np
import matplotlib.pyplot as plt
dirs = []
names = []
lengths = []
@wesm
wesm / groupsort.py
Created January 10, 2012 19:10
Stable O(max(n, k)) counting sort on n integers in range [0, ..., k - 1]
@cython.boundscheck(False)
@cython.wraparound(False)
def groupsort_indexer(ndarray[int32_t] index, Py_ssize_t ngroups):
cdef:
Py_ssize_t i, loc, label, n
ndarray[int32_t] counts, where, result
# count group sizes, location 0 for NA
counts = np.zeros(ngroups + 1, dtype='i4')
n = len(index)
@wesm
wesm / SelfMerge.ipynb
Created September 17, 2012 18:47
Self merge example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wesm
wesm / gist:3831420
Created October 4, 2012 04:10
Parser shootout
# pylint: disable=W0612
import time
import pandas as pd
import numpy as np
import iopro
import gc
@wesm
wesm / gist:3904544
Created October 17, 2012 08:55
Foo
{
"metadata": {
"name": "Basics"
},
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "code",