[Numpy-discussion] Numpy where
Nathaniel Smith
njs at pobox.com
Thu Mar 12 21:25:05 EDT 2015
On Mar 12, 2015 5:02 PM, "Charles R Harris" <charlesr.harris at gmail.com>
wrote:
>
> Hi All,
>
> This is apropos gh-5582 dealing with some corner cases of np.where. The
following are the current behavior
>
> >>> import numpy
> >>> numpy.where(True) # case 1
> ... (array([0]),)
> >>> numpy.where(True, None, None) # case 2
> ... array(None, dtype=object)
> >>> numpy.ma.where(True) # case 3
> ... (array([0]),)
> >>> numpy.ma.where(True, None, None) # case 4
> ... (array([0]),)
>
> The question is, what exactly should be done in these cases? I'd be
inclined to raise an error for cases 1 and 3. Case two looks correct to me
if we agree that scalar inputs are acceptable. Case 4 looks wrong.
I can't think of any reason scalars wouldn't be acceptable. So everything
you suggest sounds right to me.
-n
Hi All,
This is apropos gh-5582 <https://github.com/numpy/numpy/pull/5582> dealing
with some corner cases of np.where. The following are the current behavior
>>> import numpy
>>> numpy.where(True) # case 1
... (array([0]),)
>>> numpy.where(True, None, None) # case 2
... array(None, dtype=object)
>>> numpy.ma.where(True) # case 3
... (array([0]),)
>>> numpy.ma.where(True, None, None) # case 4
... (array([0]),)
The question is, what exactly should be done in these cases? I'd be
inclined to raise an error for cases 1 and 3. Case two looks correct to me
if we agree that scalar inputs are acceptable. Case 4 looks wrong.
Thoughts?
Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion at scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150312/be2e568f/attachment.html>
More information about the NumPy-Discussion
mailing list