More Useful Array Operations.

Table Of Contents:

  1. Maximum,
  2. Minimum,
  3. Sum,
  4. Mean,
  5. Product,
  6. Standard Deviation

(1) data.max()

  • data.max( ) will give you the ‘max’ value present in the array.

Example:

import numpy as np

data = np.array([3,1,5,9,2,-3,9,10])

data.max()

Output:

10

(2) data.min()

  • data.min( ) will give you the ‘minimum’ value present in the array.

Example:

import numpy as np

data = np.array([3,1,5,9,2,-3,9,10])

data.min()

Output:

-3

(3) data.sum()

  • data.sum( ) will give you the ‘sum’ of values present in the array.

Example:

import numpy as np

data = np.array([3,1,5,9,2,-3,9,10])

data.sum()

Output:

36

(4) np.prod()

  • np.prod( ) will give you the ‘product’ of values present in the array.

Example:

import numpy as np

data = np.array([3,1,5,9,2,-3,9,10])

np.prod(data)

Output:

-72900

(5) np.std()

  • np.std( ) will give you the ‘standard deviation’ of values present in the array.

Example:

import numpy as np

data = np.array([3,1,5,9,2,-3,9,10])

np.std(data)

Output:

4.301162633521313

Leave a Reply

Your email address will not be published. Required fields are marked *