calculate quartiles python

Solutions on MaxInterview for calculate quartiles python by the best coders in the world

showing results for - "calculate quartiles python"
Maximilian
23 Jan 2020
1# credit to the source link
2
3import numpy as np
4
5quant = np.quantile(arr, q)
6
7# arr: array - like object (list or np.array)
8# q: float from 0 to 1
Anton
13 Jan 2017
1>>> np.percentile(df.time_diff, 25)  # Q1
20.48333300000000001
3
4>>> np.percentile(df.time_diff, 50)  # median
50.5
6
7>>> np.percentile(df.time_diff, 75)  # Q3
80.51666699999999999
9