As someone who has used numpy for many years and written a great deal of production code using it, I was surprised when I read through this and saw some numpy tricks that I didn't know regarding the speeds of various operations! This is really a fantastic reference that provides a deeper level of understanding of what numpy does under the hood.<p>One thing I will highlight that the author just touched on briefly, is that numpy combined with numba is really a phenomenal combination for dealing with very computationally intensive problems.<p>The folks at Continuum Analytics have really done a fantastic job building numba (numba.pydata.org), which JIT compiles a subset of python functions using LLVM, and is designed to work seamlessly with numpy arrays. Numba makes it much easier to speed up performance bottlenecks and allows you to easily create numpy ufuncs which can take advantage of array broadcasting.
Immediately recognized the domain name. Months ago I was doing yet another search on how to do geospatial plotting with Matplotlib, the kind that mostly works-out-of-the-box in R/ggplot2, but, because of some latent fragmentation from Py2v3, was not well-documented anywhere in Python/matplotlib. And while I've come to really like and respect Matplotlib, the documented examples stray far from what they should for purposes of API illustration, and so learning it has been a test in patience.<p>Anyway, Mr. Rougier's Matplotlib was both informative, concise, and beautiful. Actually, I think my appreciation for matplotlib came from reading his guide: <a href="https://www.labri.fr/perso/nrougier/teaching/matplotlib/" rel="nofollow">https://www.labri.fr/perso/nrougier/teaching/matplotlib/</a>
The site is down for me, but you can see the content nicely formatted on GitHub: <a href="https://github.com/rougier/from-python-to-numpy" rel="nofollow">https://github.com/rougier/from-python-to-numpy</a><p>For cmd-f: mirror
I'd be very curious to know if there is any impact to choosing Numpy C ordered arrays or Fortran ordered arrays. As a long time Matlab user (since 1993) who moved to Python 3 years ago, I have always defaulted to Fortran order because it was what I was used to and seemed more intuitive. I did play with C ordered arrays but didn't find an advantage in my limited investigation.
Does anyone have a recommendation for something similar to this but for Python itself? I have been trying to find something that is not necessarily an intro or crash course book but a book with tips, great explanations, and neat examples (which this e-book(?)/site has).<p>I see that the author has responded to a couple comments here. Thank you for your great work! It's always great to have a nice reference material with concise examples. I think this will be helpful to everyone(beginners and advanced python users alike)!
this book is amazing! specially the authors sense of humor makes reading it fun.<p>> For example, can you tell what the two functions below are doing? Probably you can tell for the first one, but unlikely for the second (or your name is Jaime Fernández del Río and you don't need to read this book).
I just check the first example from introduction to vectorization: <a href="http://www.labri.fr/perso/nrougier/from-python-to-numpy/#id5" rel="nofollow">http://www.labri.fr/perso/nrougier/from-python-to-numpy/#id5</a>, (add_python and add_numpy) and benchmark results are nearly the same: 75.4ns and 77.7ns accordingly.
Anyone (author) know what was used to generate the cover image of cubes and shadows?<p>Edit: it's sketchup - there's a .skp file in the data/ subdirectory of the github repo for the book.
> be warned that I'm a bit picky about typography & design: Edward Tufte is my hero<p>And it shows, the theme is beautiful. Also some of the best ASCII diagrams I've seen. Worth a look at the source, even if you don't care about Python.