al ar az ca co ct dc de fl if you divide each row by the total contribution amountyou get the relative percentage of total donations by state for each candidatein [ ]percent totals div(totals sum( )axis= in [ ]percent[: out[ ]cand_nm obamabarack contbr_st ak al ar az ca co ct dc de fl romneymitt thought it would be interesting to look at this data plotted on mapusing ideas from after locating shape file for the state boundaries (atlasftp html?open=chpboundand learning bit more about matplotlib and its basemap toolkit ( was aided by blog posting from thomas lecocq) ended up with the following code for plotting these relative percentagesfrom mpl_toolkits basemap import basemapcm import numpy as np from matplotlib import rcparams from matplotlib collections import linecollection import matplotlib pyplot as plt from shapelib import shapefile import dbflib obama percent['obamabarack'fig plt figure(figsize=( )ax fig add_axes([ , , , ]lllat urlat lllon - urlon - data aggregation and group operations www it-ebooks info