Book Image

Learning NumPy Array

By : Ivan Idris
Book Image

Learning NumPy Array

By: Ivan Idris

Overview of this book

Table of Contents (14 chapters)
Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

NumPy numerical types


Python has an integer type, a float type, and a complex type; however, this is not enough for scientific computing. In practice, we need even more data types with varying precision, and therefore, different memory size of the type. For this reason, NumPy has a lot more data types. The majority of NumPy numerical types end with a number. This number indicates the number of bits associated with the type. The following table (adapted from the NumPy user guide) gives an overview of NumPy numerical types:

Type

Description

bool

This stores boolean (True or False) as a bit

inti

This is a platform integer (normally either int32 or int64)

int8

This is an integer ranging from-128 to 127

int16

This is an integer ranging from -32768 to 32767

int32

This is an integer ranging from -2 ** 31 to 2 ** 31 -1

int64

This is an integer ranging from -2 ** 63 to 2 ** 63 -1

uint8

This is an unsigned integer ranging from 0 to 255

uint16

This is an unsigned integer...