Learning NumPy Array by Ivan Idris
I first need to make a disclaimer. I work for a meteorological organisation and many of the examples in this book are taken from meteorology. This made me immediately like this book. In fact, I have run in-house training for meteorologists and climatologists and so it is exciting to find a book that uses examples from meteorology.
Most people who are doing scientific work in Python are aware of NumPy. It is a high performance library for Python that is useful for a large range of scientific computing. One of the criticisms that has sometimes been levelled against Python is that it is too slow for manipulating large datasets. This is very adequately addressed by by NumPy and the libraries that are built on top of it such as Matplotlib, SciPy and Pandas.
This book makes two assumptions:
- That you already know Python and how to program with it.
- That you have a mathematical, statistical or scientific background.
The book starts by explaining how to install NumPy on the three main operating systems. This is explained in clear step-by-step instructions. Unfortunately, for OS X, the instructions are slightly outdated as the link referenced in the text refers to a .DMG while the site now hosts a .WHL.
The book then gives a brief but useful overview of NumPy arrays, explains the benefits of using them and discusses their attributes. This is a useful chapter as the documentation that is provided with NumPy is a bit sketchy on some of these details.
Chapter two introduces many basic functions for manipulating arrays. This will be one of the most useful chapters for someone learning NumPy and later will serve as a useful reference.
Chapter 3 introduces some real applications and at this stage the reader will start learning just how NumPy can be applied and why it is useful.
There are some basic examples such as determining basic statistics for temperature and then goes into a very nice, extended example about looking for evidence of global warming within a dataset.
This example includes using Matplotlib for plotting results.
The following chapter introduces Pandas. It describes Pandas as “just a collection of fancy wrappers around NumPy, Matplotlib and other Python libraries”. This is a bit like describing Buckingham Palace as “just a collection of fancy rooms”. Pandas, like NumPy, is worthy of a book and indeed at least one very good book has been written about it.
Having said that, the chapter is a very useful one. To gain benefit from it, though, will require a knowledge of statistical techniques like autoregression and autocorrelation.
The penultimate chapter covers testing Python programming and includes a few tips for testing NumPy routines (such as ensuring that arrays are “almost” equal).
The final chapter is a medley of small topics that talk about the scientific Python ecosystem.
Overall, this is a handy little book for someone that is new to NumPy and looking for an accelerated tutorial. Some chapters will also serve as a handy reference.
Learning NumPy Array is available from https://www.packtpub.com/application-development/learning-numpy-array
Full disclosure: I was given a free copy of the e-book for review.