NumPy

numpy.asarray

The numpy.asarray function converts a data structure to a NumPy array.

This function is similar to np.array (although with fewer options), the biggest difference being the fact that np.array generates -by default- an independent copy of the structure passed as an argument, whereas numpy.asarray does not.

Submitted by admin on Fri, 01/22/2021 - 14:32

numpy.mean

The numpy.mean function returns the average of the elements in array a. By default the average of the array is calculated once it is flattened. If an axis is specified, only that axis will be considered in the calculation.

Submitted by admin on Mon, 01/21/2019 - 15:44

ndarray.shape

The numpy.ndarray.shape attribute returns a tuple with the size of the array, but can also be used to resize it. As with the numpy.reshape function, one of the dimensions sizes can be -1, in which case the size of that dimension is inferred from the number of elements in the array and the size of the other dimensions.

Submitted by admin on Mon, 01/21/2019 - 10:34