Book Image

NumPy Cookbook - Second Edition

By : Ivan Idris
Book Image

NumPy Cookbook - Second Edition

By: Ivan Idris

Overview of this book

<p>NumPy has the ability to give you speed and high productivity. High performance calculations can be done easily with clean and efficient code, and it allows you to execute complex algebraic and mathematical computations in no time.</p> <p>This book will give you a solid foundation in NumPy arrays and universal functions. Starting with the installation and configuration of IPython, you'll learn about advanced indexing and array concepts along with commonly used yet effective functions. You will then cover practical concepts such as image processing, special arrays, and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project with the help of examples. At the end of the book, you will study how to explore atmospheric pressure and its related techniques. By the time you finish this book, you'll be able to write clean and fast code with NumPy.</p>
Table of Contents (19 chapters)
NumPy Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


NumPy is famous for its efficient arrays. This fame is partly due to the ease of indexing. We will demonstrate advanced indexing tricks using images. Before diving into indexing, we will install the necessary software—SciPy and PIL. If you feel it is required, review the Installing matplotlib recipe in Chapter 1, Winding Along with IPython.

In this chapter and in other chapters, we will use the following imports:

import numpy as np 
import matplotlib.pyplot as plt
import scipy

We will also use the newest syntax for the print() Python function as much as possible.

Note

Python 2 is a still popular major Python version, but it is not compatible with Python 3. Python 2 is officially supported until 2020. One of the main differences is the syntax for the print() function. This book uses code that is as compatible with Python 2 and Python 3 as possible.

Some of the examples in this chapter involve manipulating images. In order to do that, we will require the Python Image Library (PIL),...