Chapter 2. Beginning with NumPy Fundamentals
After installing NumPy and getting some code to work, it's time to cover NumPy basics.
The topics we shall cover in this chapter are:
Data types
Array types
Type conversions
Array creation
Indexing
Slicing
Shape manipulation
Before we start, let me make a few remarks about the code examples in this chapter. The code snippets in this chapter show input and output from several IPython sessions. Recall that IPython was introduced in Chapter 1, NumPy Quick Start, as the interactive Python shell of choice for scientific computing. The advantages of IPython are the PyLab switch that imports many scientific computing Python packages, including NumPy, and the fact that it is not necessary to explicitly call the print
function to display variable values. However, the source code delivered alongside the book is regular Python code that uses imports
and print
statements.