'santorumrick''republican'nowusing this mapping and the map method on series objectsyou can compute an array of political parties from the candidate namesin [ ]fec cand_nm[ : out[ ] obamabarack obamabarack obamabarack obamabarack obamabarack namecand_nm in [ ]fec cand_nm[ : map(partiesout[ ] democrat democrat democrat democrat democrat namecand_nm add it as column in [ ]fec['party'fec cand_nm map(partiesin [ ]fec['party'value_counts(out[ ]democrat republican couple of data preparation points firstthis data includes both contributions and refunds (negative contribution amount)in [ ](fec contb_receipt_amt value_counts(out[ ]true false to simplify the analysisi'll restrict the data set to positive contributionsin [ ]fec fec[fec contb_receipt_amt since barack obama and mitt romney are the main two candidatesi'll also prepare subset that just has contributions to their campaignsin [ ]fec_mrbo fec[fec cand_nm isin(['obamabarack''romneymitt'])donation statistics by occupation and employer donations by occupation is another oft-studied statistic for examplelawyers (attorneystend to donate more money to democratswhile business executives tend to donate more to republicans you have no reason to believe meyou can see for yourself in the data firstthe total number of donations by occupation is easy data aggregation and group operations www it-ebooks info