我正在尝试区分应该使用np.quantile()或np.percentile()的场景。
>>> 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它们都给出了相同的结果,并在其实现中调用了_quantile_unchecked()。
最好的用例是什么?
发布于 2019-03-27 22:10:15
它们是等效的。如果您更愿意指定0,1中的q,请使用np.quantile。对于0,100,请使用np.percentile。
文档:https://docs.scipy.org/doc/numpy/reference/generated/numpy.percentile.html
https://stackoverflow.com/questions/55379220
复制相似问题