Basic Statistics on Numpy Arrays

Dive into the basic statistics on Numpy arrays and their functions.

We'll cover the following

Basic statistics

np.mean

It computes the arithmetic mean along the specified axis of the numpy array. It takes in an axis parameter.

  • If the axis is not specified, it returns the mean of the flattened version of the array.

  • If the axis is specified as zero, it returns the mean across each column.

  • If the axis is specified as one, it returns the mean across each row.

np.std

It computes the standard deviation along the specified axis of the numpy array. It takes in an axis parameter.

  • If the axis is not specified, it returns the standard deviation of the array’s flattened version.

  • If the axis is specified as zero, it returns the standard deviation across each column.

  • If the axis is specified as one, it returns the standard deviation across each row.

np.var

It computes the variance along the specified axis of the Numpy array. It takes in an axis parameter.

  • If the axis is not specified, it returns the variance of the flattened version of the array.

  • If the axis is specified as zero, it returns variance across each column.

  • If the axis is specified as one, it returns variance across each row.

Get hands-on with 1200+ tech skills courses.