Python, NumPy, matplotlib
Those with prior programming experience may benefit from the following introduction to Python that has been written for an audience in the humanities.
- Python Programming for the Humanities by Folgert Karsdorp and Maarten van Gompel
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.
- Introduction to Computer Science and Programming (MIT 6.00x) taught by Eric Grimson and John Guttag (among others).
- Learn to Programm: The Fundamentals (University of Toronto) taught by Jennifer Campbell and Paul Gries.
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.
- NumPy: creating and manipulating numerical data (part of the excellent Python Scientific Lecture Notes)
- NumPy indexing
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).