Been a little while since I’ve been able to update this blog, or do much Python programming. Finally had a chance to start working my way through the first proper chapter and rather quickly ran into a problem with using
matplotlib within the virtual environment.
Briefly, I need to run Python as a framework within the virtual environment for
matplotlib to be able to use the GUI elements to draw plots. A quick google turned up this script which solved the problem nice and easily.
Edit: I (of course) hadn’t fully tested this; this fix meant that
matplotlib was working, but I hadn’t tested to see whether it would actually draw the plots. To get the plots to display, I had to alter the
backend parameter in the
matplotlib/mpl-data/matplotlibrc file. It was set to MacOSX (which can be easily found by running
matplotlib.get_backend()); setting it to GTK3Agg as explained here, and running the
show() as below made all of the plots appear.
import matplotlib.pyplot as p p.show()
And, of course, making this change resulted in further problems at another stage. After closing my IPython session and starting a new one, I discovered that attempting to import
matplotlib‘s backend set to GTK3Agg causes an illegal line. Resetting the backend to MasOSX fixed this.
After some testing, the other options for the backend setting all produced the “illegal line” warning. Strangely, however, this error didn’t really seem to effect anything.
pandas was still loading fine and working.
While the Python for Data Analysis book provides a lot of data for playing around with, I’ve also found The Leeds Data Mill which includes a lot of data sets originating from Leeds, the local council and so on. This should provide me with a great way to apply what I learn from the Data Analysis book to some real world data sets. Will be interesting to see if I learn anything from it as well.