Replies: 1 comment
-
I wouldn't want to complicate the interface to To start with, we have to figure out what we need to do to >>> b[[[0, 0], [1, 1]]]
<Array [[[7], [7]], ... 8, 9, 10], [8, 9, 10]]] type='2 * 2 * var * int64'> That is, the And then we can use it: >>> c = ak.cartesian((a, b[[[0, 0], [1, 1]]]), axis=2, nested=True)
>>> c.type
2 * var * var * var * (int64, int64)
>>> c.tolist()
[
[
[[(1, 7)], [(2, 7)]],
[[(3, 7)]]
],
[
[[(4, 8), (4, 9), (4, 10)]],
[[(5, 8), (5, 9), (5, 10)], [(6, 8), (6, 9), (6, 10)]]
]
] Then the question becomes, how do we get Maybe you can think of what, in general, that function should be named or described as—either for making For getting this indexer in a not-too-ridiculous way, there's >>> ak.ones_like(ak.num(a, axis=2)) * np.arange(len(a))
<Array [[0, 0], [1, 1]] type='2 * var * int64'> The |
Beta Was this translation helpful? Give feedback.
-
Consider
I would expect some incantation of
ak.cartesian([a, b], ...)
to producec
but so far have not been successful. I think such a desire could be keyed bynested=True, axis=-1
, i.e. differing depths can in principle be supported when nesting. But perhaps the full generality ofak.cartesian
can only be specified with a tuple of axes?Beta Was this translation helpful? Give feedback.
All reactions