Skip to content

Zero-copy view of offsets and flattened data Numpy arrays as 2D Awkward arrays #2848

Answered by agoose77
gipert asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gipert, interesting discussion!

  1. We don't publicly expose a direct mapping from dtype to offsets. I'd suggest just writing a mapping yourself (it won't be very big). Also, see (3). Note that our kernels only support a small set of dtypes, so anything that's not int64 will often be copied once the array is manipulated.
  2. We don't provide any layout types with an implicit zero start index. I think you're going to have to copy here, unfortunately.
  3. You don't need to use ak.from_buffers here. You can also directly construct the layout nodes using our layout system. This would mean that you didn't need to figure out the index-type associated with a dtype.
    e.g.
offsets = np.empty(len(cumulati…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@gipert
Comment options

@gipert
Comment options

@agoose77
Comment options

@gipert
Comment options

Answer selected by gipert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants