from scipy.stats import iqr x = numpy.array([4.1, 6.2, 6.7, 7.1, 7.4, 7.4, 7.9, 8.1]) print(iqr(x, rng=(25,75), interpolation='midpoint'))