[Numpy-discussion] Was the range() function ever created?

Robert Kern robert.kern at gmail.com
Sat May 25 00:56:01 EDT 2019


On Fri, May 24, 2019 at 9:33 PM C W <tmrsg11 at gmail.com> wrote:

> Thank you, Robert. I will take it up to the Pandas-dev mailing list.
>
> I'm not sure if I follow you on "right semantics for the shape of the
> output." Range is just a summary statistic which is a number.
>
> I'm not an expert, but wouldn't something like this do?
> def range(vec):
>    return np.max(vec) - np.min(vec)
>

Oh.You referenced the R range() function, which returns the minimum and the
maximum as separate numbers, not their difference.

  https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/range

And the pandas issue that you referenced was asking for the same.

In fact, numpy does have the function you are looking for, as Juan noted.
It's called `ptp()` (early numpy developers tended to be more from a signal
processing background than a statistics background).

-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190524/92ac3b05/attachment.html>


More information about the NumPy-Discussion mailing list