May 2019
Beginner
528 pages
29h 51m
English
An array has various methods that perform calculations using its contents. By default, these methods ignore the array’s shape and use all the elements in the calculations. For example, calculating the mean of an array totals all of its elements regardless of its shape, then divides by the total number of elements. You can perform these calculations on each dimension as well. For example, in a two-dimensional array, you can calculate each row’s mean and each column’s mean.
Consider an array representing four students’ grades on three exams:
In [1]: import numpy as npIn [2]: grades = np.array([[87, 96, 70], [100, 87, 90],...: [94, 77, 90], [100, 81, 82]])...:In [3]: gradesOut[3]:array([[ 87, 96, 70],[100, 87, ...
Read now
Unlock full access