Does the awkward library provide a way to slice out all attributes of a given name, regardless of the level? I was thinking something like this:
import awkward as ak
obj = {
'resource_id': 'abc',
'events': [
{'resource_id': '123', 'value': 12, 'picks':
[{'resource_id': 'asd', 'value': 1},
{'resource_id': 'dll', 'value': 12}
]
},
{'resource_id': '456', 'value': 12, 'picks':
[{'resource_id': 'cvf', 'value': 23},
{'resource_id': 'ggf', 'value': 34},
]
},
]
}
ar = ak.from_iter(obj)
rid = ar[..., 'resource_id']
The value of rid
is simply the string 'abc' but I was expecting something more like the following:
[
['abc'],
['events':[
[['123'], 'picks':[['asd'], ['dll']]],
[['456'], 'picks':[['cvf'], ['ggf']]],
]
]
However, I am still trying to get my head around awkward arrays so I could be completely off here.