NumPy ndarrays

Arrays are vital objects in the data analysis scenario. Arrays allow for structured handling of elements that are stacked across rows and columns. The elements of an array are bound by the rule that they should all be of the same data type. For example, the medical records of five patients have been presented as an array as follows:

Blood glucose level

Heart rate

Cholesterol level

Peter Parker

100

65

160

Bruce Wayne

150

82

200

Tony Stark

90

55

80

Barry Allen

130

73

220

Steve Rogers

190

80

150

It is seen that all 15 elements are of data type int. Arrays could also be composed of strings, floats, or complex numbers. Arrays could be constructed from lists—a widely ...

Get Mastering pandas - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.