[Numpy-discussion] np.sign and object comparisons
Sebastian Berg
sebastian at sipsolutions.net
Mon Aug 31 14:06:12 EDT 2015
On Mo, 2015-08-31 at 10:23 -0700, Stephan Hoyer wrote:
> On Mon, Aug 31, 2015 at 1:23 AM, Sebastian Berg
> <sebastian at sipsolutions.net> wrote:
> That would be my gut feeling as well. Returning `NaN` could
> also make
>
> sense, but I guess we run into problems since we do not know
> the input
> type. So `None` seems like the only option here I can think of
> right
> now.
>
>
> My inclination is that return NaN would be the appropriate choice.
> It's certainly consistent with the behavior for float dtypes -- my
> expectation for object dtype behavior is that it works exactly like
> applying the np.sign ufunc to each element of the array individually.
>
I was wondering a bit if returning the original object could make sense.
It would work for NaN (and also decimal versions of NaN, etc.). But I am
not sure in general.
- Sebastian
>
> On the other hand, I suppose there are other ways in which an object
> can fail all those comparisons (e.g., NaT?), so I suppose we could
> return None. But it would still be a weird outcome for the most common
> case. Ideally, I suppose, np.sign would return an array with int-NA
> dtype, but that's a whole different can of worms...
>
>
> Stephan
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150831/fbf067c1/attachment.sig>
More information about the NumPy-Discussion
mailing list