Is there a numpy max min function?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 22:45:24

问题


Is there a numpy function that gives for a given numpy array its maximum - minimum value, i.e. numpy.max(a) - numpy.min(a) ?

e.g.

numpy.xxx([4,3,2, 6] = 4 since max = 6, min = 2, 6 - 4 = 2)

Reason: performance increase since max and min would cause twice the iteration of the array (which is in my case 7.5 million or more numbers).


回答1:


Indeed there is such a function -- it's called numpy.ptp() for "peak to peak".



来源:https://stackoverflow.com/questions/9312756/is-there-a-numpy-max-min-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!