Requesting Awkward 0 → Awkward 1 cheat-sheet
See original GitHub issueI’ve recently started switching over to awkawrd1, and I’d like to create a new array with the same layout (or just shape - I’m not yet sure if different content types are considered different layouts - say int vs float or even int8 vs int32). For example, I have a constant mass hypothesis that I want with every jagged four vector. Or a constant weight for each row. I’m happy to add a concrete example if helpful.
In awkward0, I would call ones_like() and then multiply by my value. For numpy, I would use np.ones_like(...) and again multiply. But having looked through the awkward1 documentation, I can’t seem to find the equivalent. As far as I understand, I can’t just do this with ak.Array. I’m sure it’s possible in awkward1 and that I’m overlooking the right term (I’ve been reading the awkward1 docs over a number of updates, so it’s certainly possible that I’ve missed it), but some additional documentation on this could be helpful - I imagine that I won’t be the only person looking for something like this. Or if it already exists, could you point me in the right direction?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)

Top Related StackOverflow Question
No worries at all @jpivarski! You always answer so helpfully and quickly that it makes issues like this quite minor. (Plus, I made the transition years ago). I really appreciate the effort that you and others put into such a useful package!
No, this sounds like a to-do item that gets “done” by waiting so long that it’s no longer relevant. We probably have more new users of Awkward 1 than transitioning users of Awkward 0.
Sorry I fell off the ball on this, @raymondEhlers. I’ll close the issue.