# jagged array of records where a record is None
arr = ak.Array([[
{"pt": 100., "eta": 0.5},
{"pt": 200., "eta": 1.0},
{"pt": 300., "eta": 1.5}
], [
{"pt": 150., "eta": -0.5},
{"pt": 250., "eta": -1.0},
None
]])
# type is ListType(OptionType(...)) since there is a None
print("arr type:", repr(arr.type.content))
# Remove the event where there is a None
arr = arr[:1]
print("has nones:", ak.is_none(arr))
# type still has OptionType
print("arr type:", repr(arr.type.content))
# to_packed does not fix it
arr = ak.to_packed(arr)
print("arr type:", repr(arr.type.content))
# it is fixed when we explicitly drop nones from the array
arr = ak.drop_none(arr)
print("arr type:", repr(arr.type.content))
Version of Awkward Array
2.9.0
Description and code to reproduce
ak.to_packeddoes not seem to removeOptionTypefrom an array of records even if there are no moreNones in the array. This is a problem e.g. when writing to TTree with uproot, since TTree has no concept of option types.Minimal reproducer: