Other Sellers on Amazon
& FREE Shipping
90% positive over last 12 months
Usually ships within 4 to 5 days.
+ $3.99 shipping
85% positive over last 12 months
& FREE Shipping
89% positive over last 12 months
Usually ships within 3 to 4 days.
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required. Learn more
Read instantly on your browser with Kindle Cloud Reader.
Using your mobile phone camera - scan the code below and download the Kindle app.
NumPy Cookbook Paperback – October 25, 2012
| Ivan Idris (Author) Find all the books, read about the author, and more. See search results for this author |
| Price | New from | Used from |
Enhance your purchase
Over 70 interesting recipes for learning the Python open source mathematical library, NumPy
Overview
- Do high performance calculations with clean and efficient NumPy code
- Analyze large sets of data with statistical functions
- Execute complex linear algebra and mathematical computations
In Detail
Today's world of science and technology is all about speed and flexibility. When it comes to scientific computing, NumPy is on the top of the list. NumPy will give you both speed and high productivity.
"NumPy Cookbook" will teach you all about NumPy, a leading scientific computing library. NumPy replaces a lot of the functionality of Matlab and Mathematica, but in contrast to those products, it is free and open source.
"Numpy Cookbook" will teach you to write readable, efficient, and fast code that is as close to the language of Mathematics as much as possible with the cutting edge open source NumPy software library.
You will learn about installing and using NumPy and related concepts. At the end of the book, we will explore related scientific computing projects.
This book will give you a solid foundation in NumPy arrays and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project through examples.
"NumPy Cookbook" will help you to be productive with NumPy and write clean and fast code.
What you will learn from this book
- Learn advanced Indexing and linear algebra
- Know reshaping automatically
- Dive into Broadcasting and Histograms
- Profile NumPy code and visualize your profiling results
- Speed up your code with Cython
- Use the array interface to expose foreign memory to NumPy
- Use universal functions and interoperability features
- Learn about Matplotlib and Scipy which is often used in conjunction with Numpy
Approach
Written in Cookbook style, the code examples will take your Numpy skills to the next level.
Who this book is written for
This book will take Python developers with basic Numpy skills to the next level through some practical recipes.
- Print length226 pages
- LanguageEnglish
- PublisherPackt Publishing
- Publication dateOctober 25, 2012
- Dimensions7.5 x 0.51 x 9.25 inches
- ISBN-101849518920
- ISBN-13978-1849518925
Inspire a love of reading with Amazon Book Box for Kids
Discover delightful children's books with Amazon Book Box, a subscription that delivers new books every 1, 2, or 3 months — new Amazon Book Box Prime customers receive 15% off your first box. Sign up now
Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.
Product details
- Publisher : Packt Publishing (October 25, 2012)
- Language : English
- Paperback : 226 pages
- ISBN-10 : 1849518920
- ISBN-13 : 978-1849518925
- Item Weight : 13.9 ounces
- Dimensions : 7.5 x 0.51 x 9.25 inches
- Best Sellers Rank: #6,999,600 in Books (See Top 100 in Books)
- #5,180 in Python Programming
- #5,654 in Data Processing
- Customer Reviews:
About the author

Ivan Idris was born in Bulgaria from Indonesian parents. He moved to the Netherlands in the 1990s, where he graduated from high school and got a MSc in Experimental Physics.
His graduation thesis had a strong emphasis on Applied Computer Science. After graduating he worked for several companies as Java Developer, Datawarehouse Developer and QA Analyst.
His main professional interests are Business Intelligence, Big Data and Cloud Computing. Ivan Idris enjoys writing clean testable code and interesting technical articles.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
There was a problem filtering reviews right now. Please try again later.
The book covers examples from famous algorithms (Fibonacci, Sieve of Eratosthenes, etc), finance, etc, mainly to show the usage for various NumPy functions, both simple and advanced. There is a full chapter of recipes on Audio and Image processing techniques. There is also discussion of using memory mapped files, sharing data with the Python Image Library (PIL) through the array interface, converting code to Cython for speed, universal functions (none on vectorize() strangely), masking, etc. There is other information, such as interfacing with R using RPy2, running Numpy on Google App Engine and PiCloud (I didn't pay too much attention to these since I didn't anticipate using them).
The format of the recipes were a bit unusual. Generally it tells you what you can do with it (in the title), then gives a quick overview of the approach (in English), followed by the full code to do accomplish the recipe. The recipes in the book flips this around, putting partial code with some explanation first, then the full code, and then the overview. So the reading (or following along with a Python shell) is not linear, reader has to jump back and forth. Not a huge deal once you recognize it, but using a more linear style may enhance the reading and learning experience in future editions.
I read this book after I read "Learning Numpy Arrays" by the same author, and there is quite a bit of overlap in the examples. Perhaps not surprising because the subject is mostly identical. However, I think its still worth purchasing both the books because each book has enough unique content.
There is very little introduction in to what Numpy and Scipy actually are. No introductory talk as to the new objects these packages introduce. e.g. It doesn't explain what the ndarray object gives you over a traditional list object. Instead, there's the obligatory chapter showing you how to install stuff then, *still in the first chapter*, you are thrown in to the web notebook functionality. You haven't even covered array indexing at this point (that's in Chapter 2).
The recipes in this book have a somewhat unusual style:
1. State what is to be achieved in the recipe
2. List a few of the key lines of code with minimal explanation
3. Show the results or outcome
4. Show the full code sample for the recipe
The problem with this approach is that the key lines of code shown in 2 aren't always comprehensible without seeing them in context. For example, they may contain variables that aren't defined until several pages *later*. So you don't get to see the context until right at the end of the recipe. This means that you need to flip back and forth between the explanations in 2 and the full code sample in 4 in order to figure out what's going on.
Another issue with the book is that it doesn't explain a lot of what it shows. Take page 32, where it's showing you how to make copies of an array. We have a 2-D matrix that represents the Lena test image:
- First we are told to make a copy of it with "acopy = lena.copy()" so far so good.
- Then we are told to create a view of the array: "aview = lena.view()" Well, that's fine but the book doesn't tell me at a "view" is. I have to Google it. The numpy manual is a little more enlightening, but I still have questions.
- Then set all the values of the view to 0 with a flat iterator: "aview.flat = 0" What's a flat iterator? I don't know. Googling, I discover lots of links to Numpy pages. So I guess it's not a general term, but something quite Python/Numpy specific. If it's not a term in common usage then an explanation would helpful.
This is all right at the start of the book. Disappointing. I guess it's useful to have all these code snippets here to learn from, but code snippets are cheap and the book doesn't go out of its way to teach you everything that's going on in them. That's why one buys a cookbook: to get the snippets and have an explanation of how they work. I know you can't explain it all in a book, but I'm finding myself turning to Google way too often. So this cookbook has its uses but it feels rather a lot like a bunch of webpages that have been printed out and glued together without too much thought.
Some recipes aren't thorough enough to be useful. For example, the RPy2 interface which allows Python to talk to R is described so briefly that the author may as well not have bothered. There's one "recipe" on how to install RPy2, which is empty filler material. It takes up almost a whole page and the installation instructions are the same as those for any other package. The next recipe is called "Interfacing with R." All that this recipe adds is how to use the importr command to get data from R. That's it. Basically that recipe is one line of code. No interesting usage cases of R and Python. No information on how to call R's stats functions (which is the whole point of this cool interface). Wasted opportunity.
So what alternatives are there? O'Reilly's "SciPy and Numpy" is nice because it explains the background rather well. It covers the distinctions between Numpy and Scipy, and what they add to the core Python commands. There is plenty of well annotated example code. Python For Data Analysis is similar, but emphasises the pandas library more.