Book Image

Mastering Python Scientific Computing

Book Image

Mastering Python Scientific Computing

Overview of this book

Table of Contents (17 chapters)
Mastering Python Scientific Computing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The NumPy fundamental objects


The entire scientific computing functionality of NumPy and SciPy is built around two basic types of objects in NumPy. The first object is an n-dimensional array object known as ndarray, and the second object is a universal function object called ufunc. Besides these two objects, there are a number of other objects built on top of them.

The ndarray object

The ndarray object is a homogenous collection of elements that are indexed using N integers, where N is the dimension of the array. There are two important attributes of ndarray. The first is the data type of the elements of the array, called dtype, and the second is the shape of the array. The data type here can be any data type supported by Python. The shape of the arrays is an N-tuple, that is, a collection of N elements for the N-dimensional array, where each element of the tuple defines the number of elements in that dimension of the array.

The attributes of an array

Besides the shape and dtype, the other...