[Numpy-discussion] Was the range() function ever created?
tmrsg11 at gmail.com
Sat May 25 00:31:55 EDT 2019
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?
return np.max(vec) - np.min(vec)
On Sat, May 25, 2019 at 12:06 AM Robert Kern <robert.kern at gmail.com> wrote:
> On Fri, May 24, 2019 at 8:50 PM C W <tmrsg11 at gmail.com> wrote:
>> I can't be the first person who asked about range() that calculates the
>> *actual* range of two numbers.
>> I have not used numpy or pandas long enough to know, but how has it been
>> dealt with before?
> First, through `describe()`, then they added `value_range()`, then they
> deprecated `value_range()` in favor of `describe()` again.
> You can ask on the pandas-dev mailing list why:
> As for numpy, trying to come up with the right semantics for the shape of
> the output is usually when such discussions die. Functions like a
> statistical range calculation are expected to be like `min()` and `max()`
> and allow us to apply them axis-wise (e.g. just down columns or just across
> rows, or more any other axis in an N-D array). Odds are, the way that we'll
> pack the two results into a single output will probably not be what you
> want in half of the cases, so you'll just have to unpack anyways, and at
> that point, it's just not *that* much more convenient than calling
> `min()` and `max()` separately. So every time we write `xmin, xmax =
> x.min(), x.max()`, we grumble a little bit, but it's just a grumble, not a
> significant pain.
> pandas has other considerations, but you'll have to ask them.
> Robert Kern
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion