Skip to content

Why is the value of .layout.is_record of a masked RecordArray false? #3103

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

You must be logged in to vote

This is not a bug. When you look at the layout, you're looking at the low-level memory layout ("how the data are implemented", rather than "what the data mean"). Some of the layout nodes are invisible to high-level types.

>>> data = ak.Array({"a": [1, 2, 3], "b": [3, 4, 5]})
>>> data
<Array [{a: 1, b: 3}, {...}, {a: 3, b: 5}] type='3 * {a: int64, b: int64}'>

The high-level type is an array of records: 3 * {a: int64, b: int64}.

>>> data2 = data[data.b == 3]
>>> data2
<Array [{a: 1, b: 3}] type='1 * {a: int64, b: int64}'>

The high-level type is an array of records: 1 * {a: int64, b: int64}.

But whereas the layout of data is a RecordArray of two NumpyArrays,

>>> data.layout
<RecordArray is_t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by agoose77
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
Converted from issue

This discussion was converted from issue #3102 on May 06, 2024 14:03.