9951 explained code solutions for 126 technologies


python-numpyHow to calculate 3rd quartile from Numpy array


import numpy as np
arr = np.array([1,2,3,6,7,8,10,11,12,15,16,17])

val = np.percentile(arr, 75)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

np.percentile

calculate percentile of a given array on a given level

val

will contain 3rd quartile (75% percentile)