Getting started

For those new to Python

Those with prior programming experience may benefit from the following introduction to Python that has been written for an audience in the humanities.

For those new to programming

Those new to programming may wish to consider the following introductory courses before diving into the following tutorials. Both these courses are taught using Python and assume no prior exposure to computer programming. The MIT course is excellent.

For those new to NumPy

NumPy is a Python package which provides an array data structure that is widely used in the Python community to represent a two-dimensional table of data. Such a structure is useful in representing a text corpus as a table of document-term frequencies.

Those with considerable experience in Python but little exposure to NumPy will find the following series of lectures on scientific computing with Python helpful, in particular the chapter NumPy: creating and manipulating numerical data.

While NumPy functions will be introduced as they are used, readers familiar with R or Octave/Matlab will likely find themselves searching for the Python equivalent of some function in R or Octave. For example, the NumPy equivalent of R’s apply(X, 1, sum) (or rowSums(X)) is np.sum(X, axis=1). There are a number of websites that list such equivalences.

For R an Octave/Matlab users

For those new to Matplotlib

Matplotlib is the most popular graphing and visualization package for Python and this tutorial uses it. An comprehensive introduction to Matplotlib is included in the Python Scientific Lecture Notes (Matplotlib: plotting).