Python Tutorials

Python is a widely used, general purpose programming language. It features a large user community and a number of useful libraries and frameworks for data wrangling and analysis, among other tasks. I developed the following series of Python workshops in partnership with the Workshop in Methods series at Indiana University Bloomington. 

 
 
Image courtesy of #WOCinTechChat

Image courtesy of #WOCinTechChat

Introduction to Python

This workshop introduces the basic elements of Python that are commonly used for data cleaning, analysis, visualization, and other applications. Participants will also learn how to set up a "development environment" for Python on their personal computer. Computers with Python pre-loaded are available in the SSRC on a first-come, first-served basis. This workshop is intended for social scientists who are new to programming. No experience is required.

Install the tools:
Python 3.6

Download the materials:
intro_to_python_slides.pdf
intro_to_python_video (Requires Adobe Flash Player)
hello.py
workshop.py
kipling_jungle_book.txt

 
Image courtesy of #WOCinTechChat

Image courtesy of #WOCinTechChat

Introduction to Web Scraping With Python

Web scraping is a method of extracting and restructuring information from web pages. This workshop will introduce basic techniques for web scraping using the popular Python libraries BeautifulSoup and Requests. Participants will practice accessing websites, parsing information, and storing data in a CSV file. This workshop is intended for social scientists who are new to web scraping, but have some familiarity with Python or have attended the Introduction to Python workshop.

Install the tools:
Python 3.6
Requests
BeautifulSoup

Download the materials:
intro_to_webscraping_slides.pdf
intro_to_webscraping_video (Requires Adobe Flash Player)
hello.py
wim_web_scraper.py

 

 
Image courtesy of #WOCinTechChat

Image courtesy of #WOCinTechChat

Introduction to Using APIs With Python

An application programming interface (API) is a tool that allows computers to communicate and share information. For social scientists, APIs can be useful for accessing data or services from firms, organizations, or government agencies. This workshop will introduce the use of APIs to obtain data from sources such as Survey Monkey, Twitter, or Data.gov. This workshop is intended for social scientists who are new to working with APIs, but have some familiarity with Python or have attended the Introduction to Python workshop.

Install the tools:
Python 3.6
Requests

Download the materials:
intro_to_apis_slides.pdf
maps_api.py
maps_api_loop.py
charter_schools.csv