Intro to Python

(for social scientists)

by Katharina Roesler, katroesler@gmail.com

Agenda

  1. Why learn Python?
  2. Installation
  3. Python Basics
  4. Exercises
  5. Resources

Why learn Python?

  1. Free data!
  2. Fast, doesn’t crash
  3. Clean code, functions
  4. Existing libraries
  5. Lots of documentation and online help

Installation

  1. Python
  2. Python 2.7 vs. 3
  3. Homebrew for installing software
  4. Pip
  5. Pyenv or pipenv for virtual environments
  6. Sublime Text or Atom text editors
  7. Bash/shell
  8. Vim or Emacs

Exercises


All exercises and solutions are here.

An online Python interpreter is here.

Tips

  1. Write lots of comments
  2. Print output
  3. Test with subsamples:
  4. Google every issue
  5. sudo
  6. Do a fun side project, e.g. Kaggle competition

References

  1. Code Academy
  2. Nice Intro
  3. Jupyter Notebooks
  4. Topic Modeling in R
  5. Webscraper Extension in Chrome
  6. Dive Into Python Book

Questions? Comments?

katroesler@gmail.com