9951 explained code solutions for 126 technologies


python-numpyHow to calculate 1st 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, 25)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 1st quartile (25% percentile)