I am trying to distinguish the scenario in which np.quantile() or np.percentile() should be used.
>>> import numpy as np >>> a = np.array([[10, 7, 4], [3, 2, 1]]) >>> np.quantile(a, 0.5) 3.5 >>> np.percentile(a, 50) 3.5 Both of them give the same result and call _quantile_unchecked() in their implementation.
What are the best use cases?
11 Answer
They are equivalent. If you'd rather specify q from [0, 1], use np.quantile. For [0, 100], use np.percentile.