-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scalar values/shapeless arrays related issues #1055
Comments
Zero-dimensional shapes were deliberately left out, since this is how we express a scalar result. That is, we don't make a distinction between what NumPy would call I don't think the distinction NumPy makes between
>>> ak.fill_none(a, np.float32(0))
<Array [1, 0] type='2 * float32'>
>>> ak.fill_none(a, np.array(0, np.float32))
<Array [1, 0] type='2 * float32'> On the other hand, it looks like we broke filling with a NumPy array in doing so: >>> ak.fill_none(a, np.array([0], np.float32), axis=-1)
<Array [1, 0] type='2 * float32'>
>>> ak.fill_none(a, np.array([[0]], np.float32), axis=-1)
<Array [1, [0]] type='2 * union[float32, 1 * float32]'> That's off by one dimension. There's no such trouble when the fill value is a non-NumPy iterable. >>> ak.fill_none(a, 0, axis=-1)
<Array [1, 0] type='2 * float64'>
>>> ak.fill_none(a, [0], axis=-1)
<Array [1, [0]] type='2 * union[float32, 1 * int64]'>
>>> ak.fill_none(a, [[0]], axis=-1)
<Array [1, [[0]]] type='2 * union[float32, 1 * var * int64]'> I bet that will be an easy fix; I'll do it now. |
This is what's supposed to happen:
On this point, I suppose we could make high-level functions (e.g. |
Thanks for the quick and helpful replies.
This seems like a good idea. |
Version of Awkward Array
1.4.0
Description and code to reproduce
The support for shapeless arrays (i.e. numpy shape
()
) seems to be either (intentionally?) missing or broken.In case it is intentionally missing:
Other code, in particular functions that require a scalar argument (i.e.
fill_none
) may fail to operate as expected. For example, it is not possible to provide a specific-typed scalar fillvalue
argument forfill_none
which in turn will always convert the result to the default type:During the internal conversion to an awkward type/layout the superfluous dimension gets inserted.
In case that there is supposed to be support for shapeless arrays, this illustrates the inconsistency:
The text was updated successfully, but these errors were encountered: