Campaign Contributions Example

med2016.txt dataset

$ python contributions.py
Welcome to contributions.py v1.0

In this program, you can search for campaign contribution
information by zip code, city, or state.

There are 1483 total contribution entries.

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 1
Enter a 5-digit ZIP code: 19081

****There are no campaign contributions for zip code 19081.****

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 1
Enter a 5-digit ZIP code: 03766

Contribution information for LEBANON, NH 03766
  Sanders:    7 contributions totalling    $4200
  Clinton:    2 contributions totalling    $2000
     Cruz:    1 contributions totalling     $250

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 2

searching by city...

Enter a city: Bango

Here are all the cities I can find that start
with BANGO and have contributions...

      BANGOR, ME, 04401,  Democrat:    $2339, Republican:      $0

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 2

searching by city...

Enter a city: Boston

Here are all the cities I can find that start
with BOSTON and have contributions...

      BOSTON, MA, 02108,  Democrat:   $62350, Republican:   $1000
      BOSTON, MA, 02109,  Democrat:   $21200, Republican:      $0
      BOSTON, MA, 02110,  Democrat:   $24700, Republican:      $0
      BOSTON, MA, 02111,  Democrat:   $17550, Republican:    $250
      BOSTON, MA, 02113,  Democrat:    $6200, Republican:    $250
      BOSTON, MA, 02114,  Democrat:   $26200, Republican:    $500
      BOSTON, MA, 02115,  Democrat:   $22780, Republican:      $0
      BOSTON, MA, 02116,  Democrat:  $205750, Republican:   $6400
      BOSTON, MA, 02118,  Democrat:   $81004, Republican:   $1000
      BOSTON, MA, 02119,  Democrat:    $5000, Republican:      $0
      BOSTON, MA, 02120,  Democrat:    $1000, Republican:      $0
      BOSTON, MA, 02121,  Democrat:    $3200, Republican:      $0
      BOSTON, MA, 02122,  Democrat:    $2000, Republican:      $0
      BOSTON, MA, 02124,  Democrat:    $3750, Republican:      $0
      BOSTON, MA, 02125,  Democrat:     $865, Republican:      $0
      BOSTON, MA, 02127,  Democrat:   $13253, Republican:      $0
      BOSTON, MA, 02133,  Democrat:    $1000, Republican:      $0
      BOSTON, MA, 02163,  Democrat:     $500, Republican:      $0
      BOSTON, MA, 02199,  Democrat:   $16700, Republican:   $1250
      BOSTON, MA, 02210,  Democrat:   $16250, Republican:    $500
      BOSTON, MA, 02215,  Democrat:    $9900, Republican:      $0

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 3
Enter a two digit state code: VT

Top five contribution zip codes for Clinton in VT:
      BURLINGTON, VT 05401:  7 contributions totalling  $14000
      MIDDLEBURY, VT 05753:  4 contributions totalling   $9100
         NORWICH, VT 05055:  5 contributions totalling   $7650
           STOWE, VT 05672:  5 contributions totalling   $6000
       CHARLOTTE, VT 05445:  3 contributions totalling   $5700

Top five contribution zip codes for Cruz in VT:
      BURLINGTON, VT 05401:  4 contributions totalling   $5650
   ST. JOHNSBURY, VT 05819:  1 contributions totalling    $250
      MIDDLEBURY, VT 05753:  1 contributions totalling    $250
         SWANTON, VT 05488:  1 contributions totalling    $200

Top five contribution zip codes for Sanders in VT:
      BURLINGTON, VT 05401: 111 contributions totalling  $41619
     BRATTLEBORO, VT 05301: 74 contributions totalling  $37495
          PUTNEY, VT 05346: 51 contributions totalling  $25700
       CHARLOTTE, VT 05445: 47 contributions totalling  $23600
SOUTH BURLINGTON, VT 05403: 46 contributions totalling  $19983

Top five contribution zip codes for Trump in VT:
         SWANTON, VT 05488:  1 contributions totalling    $250


***Click anywhere in the graph window to continue.***

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 4
OK.  Goodbye!

Return to Lab 09