I had the opportunity from Packt Publishing to review the second edition of Numpy Beginner’s Guide. Many thanks to the publisher for this and let’s go to the review.
Content and opinions
The first chapter introduces the reader to the scientific ecosystem. The main modules are covered, but there are some small mistakes (ipython –pylab does not import Matplotlib, Numpy ans Scipy, just a subset of the first that gives a Matlab-like interface aith some renamed Numpy functions) and what I think is a bad habit (importing everything from Pylab and using it as is). Nothing is lost because in the second chapter, Numpy is properly introduced and imported explicitly. There is a link missing between the two chapters because I didn’t understand why Numpy was used this way and not with pylab.
So the second chapter is about the core Numpy data structure: the multidimensional array. The author browses through different ways of creating them, by stacking them, flattening them… The next chapter deals with universal functions, or put it in an other way, functions that run on array element by elements. There are many different way to do so, with specifics that are tackled properly.
Before the chapter of matrices, there is a useful chapter on correlation, convolution and polynomials. Although one may want to go up to Scipy for signal processing, more often than not, Numpy is enough. There enough examples to understand how everything work. Then, the much hated matrix class is introduced. There are many discussions online on whether this class is actually useful, and I won’t delve on this. Suffice to say that the power of this class can be seen in the examples.
The following chapter is about the different submodules inside Numpy: linear algebra, fft, random number. The proper pointers to Scipy are provided, as well as explicit samples. I only can regret the time shifting example is not perfect, as a filter is applied on the amplitude and the inverse FFT is applied on the amplitudes only. So the transformed signal loses all the phase information, which may be why the image is similar but not that similar to the original one.
The seventh chapter tackles different extra functions, mainly finance-related, and I have to say that I don’t know their use enough to comment. Of course, this is why they are in the middle of the book and not in the first pages as the other Numpy functions. Still, there are some useful functions here (some I didn’t know about), as sorting, searching…
When one code scientific code, one often forget about testing. And Numpy has a nice module for scientific testing. It is nice to know that this aspect of science is not forgotten here and has a proper introduction. (also don’t forget about version control!)
The last three chapters introduces additional modules. The first one was partial addressed before, Matplotlib, and if you need something more advanced, there is always the Matplotlib book also published by Packt. Then there are some examples with Scipy, Scikits (soon a new book on Machine Learning with scikit-learn will be available, also by Packt, for which I was a technical reviewer, and it is really great) and other tools. The final chapter is about Pygame, but I don’t code games 100% in Python, so I didn’t really read it!
It’s hard to be mad at the author for the import issue. But I find it also difficult not to, as the philosophy changes depending on the chapter without saying why. Still, for an introductory book to Numpy, it is great if not excellent. A lot of simple examples, a lot of checks, the good pointers to write efficient code…
[amazon template=iframe image&asin=1782166084][amazon template=iframe image&asin=B00CITNP76]