Skip to content

Instantly share code, notes, and snippets.

View mfherman's full-sized avatar

Matt Herman mfherman

View GitHub Profile
@albertsun
albertsun / calculate_pareto_median.py
Created September 27, 2011 18:18
Pareto Interpolation
# http://en.wikipedia.org/wiki/Pareto_interpolation
# Example Pareto interpolation to calculate household median income.
# Assumes that incomedata is a list of 17 elements containing table B19001 from the United States ACS 5-year summary file
from math import log
def calculate_median(incomedata):
bucket_tops = [10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 60000, 75000, 100000, 125000, 150000, 200000]
total = incomedata[0]
for i in range(2,18):