Python related things

Pre-compiled modules

Getting non-pure-Python addons to work on Windows seems to be a pain (or at least, I haven't dedicted the time to getting mingw to work...) Fortunately, the internet comes to the rescue:

Numpy

matplotlib

ipyhton

  • iPython homepage - iPython is a wonderful thing; combined with browser based notebooks, it's even better.
  • nbviewer - View iPython notebooks in static mode in a webrowser.

Python Books

The Quick Python Book 2nd edition

By Vernon L. Ceder [Leeds] [Amazon]

A quick introduction to the basics of Python programming. I found this to be a very easy read after spending some time (re)learning C++ programming. I would think this would be hard work if you didn't know some programming already. It's not really a book I'd want to own though, as it doesn't need to be re-read, and it doesn't go far enough into the language to be a reference.

Learning Python

By Mark Lutz [Leeds] [Amazon] [Foyles]

The fifth edition is more like a door stop than a book (1600 pages, which even for a computer book is long!) I'm afraid I have to agree with many of the Amazon reviewers: this book is too verbose, and many of the words could have been cut without losing information. There is a lot of repetition. I found it unhelpful that the same (simple) example would be repeated endlessly with minor variations as new ideas were introduced. Longer, more complicated worked examples would have helped in places.

However, I did find the book to be extremely clear. That it was verbose also meant it was an easy read-- something I could literally read in bed. I think it was worth reading, but I'm not sure I'll be going back to it much. There are various "cookbook" books which seem more useful-- once you know the basics, it makes more sense (to me) to look at real-world examples. For example: how would I actually use a metaclass in a complex problem?

Finally, a slight pet peeve: there's almost no mention of the standard library! Yes, the library does evolve quite quickly, and it's large. But it would be great to have a quick guide to the modules, and their main uses. The online help can do the rest, but even knowing where to start looking can be useful.

Python Pocket Reference

By Mark Lutz [Amazon] [Foyles]

Genuinely pocket sized, this 7 by 4 inch, 250 page book does what it says. It's a great little reference, for both Python 2.7 and 3.4, to the core language and main standard library modules. I've found it to be a really useful format to dip into as I've learnt about Python-- the physical book format means you can flick between pages easily, look things up the index in no time etc. Python of course comes with a great help package, and for general standard library reference, I do find myself just using the help file, or looking online. But, for example, for syntax issues, the book is much easier to flick though, and a much faster reference.

If I had to quibble, then I'd say that the module coverage at the end is a little odd: I probably don't need a quick reference to the sys module, nor to writing GUIs or interfacing with databases. I wouldn't mind having more on, say, the collections module, or similar. Maybe that's my bias as a user.

And, for the price, you can't go wrong!

Python For Data Analysis

By Wes McKinney [Amazon] [Foyles]

pandas is a data analysis library for Python, and this book, written by the original author of pandas, is an excellent guide to its usage. The book starts with some “interactive” (you are invited to download data from internet sources yourself, and use the code provided to analyse it) demos of the main features. Then chapters cover the main features: the “dataframe” model, loading and saving data, how to “wrangle” data (reshape, clean, merge), grouping operations and then some more specialist chapters on time series and financial data.

pandas is built upon the numpy optimised array system, and the book also contains an excellent introduction to numpy, along with a closing chapter on more advanced features. Similarly, matplotlib is used for plotting, and a chapter introduces this package. Also included is a chapter on the (also excellent) ipython interactive python system, and finally, an appendix which provides a brief, but useful, introduction to the basics of python itself.

Inevitably, as pandas is developed, the book won't cover the cutting edge. However, I found it to be a great introduction, and very easy to read. The code style, of mimicking an interactive python session, means you can read the book and see how the code would work, without having to actually have a computer in front of you (but that's obviously the best way to learn).