The NumPy library revolves around its multidimensional array object, numpy.ndarray. NumPy arrays are collections of elements of the same data type; this fundamental restriction allows NumPy to pack the data in a way that allows for high-performance mathematical operations.
Getting started with NumPy
Creating arrays
You can create NumPy arrays using the numpy.array function. It takes a list-like object (or another array) as input and, optionally, a string expressing its data type. You can interactively test array creation using an IPython shell, as follows:
import numpy as np
a = np.array([0, 1, 2])
Every NumPy array has an associated data type that can be accessed using the dtype attribute. If we inspect the a array, we find that its dtype is int64, which...