Skip to content
Rachel Navarre

Rachel Navarre

  • Blog
  • LearnExpand
    • Courses
    • Updates
  • Current Students
  • Research
Rachel Navarre
Rachel Navarre

Python for Social Scientists

ByRachel August 10, 2016June 11, 2026
Uncategorized

(Originally posted on my old blog on Jan 9, 2014)

As part of the content analysis I am doing for my dissertation, I’ve started to look at using Python to scrape documents from the web, as well as clean them up for analysis. In theory this should save me lots of man-hours of work; in reality, well, we’ll see.
Anyway, I though I would share my (very limited) experience and sources here. This is meant for total newbies, so if you know anything about coding, go hang out at stack overflow and make fun of me there.

For learning how to use python there are several great resources out there. Specifically, Neal Caren and the Programming Historian have great how to guides on data scraping and APIs and the like. Neal Caren’s page is definitely more beginner friendly.
Noob Note: One thing the online sources tend not to cover very well is the difference between using the terminal and the python program itself.  If you have a Mac, which I do, python already comes on your computer ready to run on the terminal. Any time you see $ in sample code, that means you should type it directly into the terminal, not in python itself. Go learn about the terminal. It is your friend. See here for some more info on the terminal, as well as how to use python in windows. 
Another good resource is code academy where the Sunlight Foundation has a class on how to use its Capitol Words API. This is a pretty good quick and dirty introduction into how to pull info from the congressional register, but there are a few issues with it.
  1. First, the code is not meant for the newest versions of Python (the print function changed).  In Python 3.x, you need to use parenthesis around what you plan to print.
  2. A second problem is with the response.json line. While the simulator will run this, in real life you are going to have to put parenthesis behind that so it reads response.json().
Hope that helps. If not, there’s always getting tenure and then forcing your graduate students to do this for you.

Post navigation

Previous Previous
Content Analysis
NextContinue
Using MaxQDA and Day One Journal for Fieldwork

Archive

  • June 2026
  • July 2025
  • June 2021
  • October 2019
  • September 2019
  • November 2018
  • March 2017
  • February 2017
  • January 2017
  • November 2016
  • August 2016

Tags

American Gov civics lesson content analysis democracy deportation detention immigration impeachment populism teaching the field Trump 1.0 voting systems what's new

Bluesky Email
  • Home
  • Privacy Policy
  • About Me

© 2026 Rachel Navarre - WordPress Theme by Kadence WP

  • Blog
  • Learn
    • Courses
    • Updates
  • Current Students
  • Research