ak.contents.IndexedOptionArray ------------------------------ .. py:module: ak.contents.IndexedOptionArray Defined in `awkward.contents.indexedoptionarray `__ on `line 54 `__. .. py:class:: ak.contents.IndexedOptionArray(self, index, content, *, parameters=None) IndexedOptionArray is an :py:obj:`ak.contents.IndexedArray` for which negative values in the index are interpreted as missing. It represents :py:obj:`ak.types.OptionType` data like :py:obj:`ak.contents.ByteMaskedArray`, :py:obj:`ak.contents.BitMaskedArray`, and :py:obj:`ak.contents.UnmaskedArray`, but the flexibility of the arbitrary ``index`` makes it a common output of many operations. IndexedOptionArray doesn't have a direct equivalent in Apache Arrow. To illustrate how the constructor arguments are interpreted, the following is a simplified implementation of ``__init__``, ``__len__``, and ``__getitem__``: .. code-block:: python class IndexedOptionArray(Content): def __init__(self, index, content): assert isinstance(index, (Index32, Index64)) assert isinstance(content, Content) for x in index: assert x < len(content) # index[i] may be negative self.index = index self.content = content def __len__(self): return len(self.index) def __getitem__(self, where): if isinstance(where, int): if where < 0: where += len(self) assert 0 <= where < len(self) if self.index[where] < 0: return None else: return self.content[self.index[where]] elif isinstance(where, slice) and where.step is None: return IndexedOptionArray( self.index[where.start : where.stop], self.content ) elif isinstance(where, str): return IndexedOptionArray(self.index, self.content[where]) else: raise AssertionError(where) .. _ak-contents-indexedoptionarray-index: .. py:attribute:: ak.contents.IndexedOptionArray.index .. _ak-contents-indexedoptionarray-copy: .. py:method:: ak.contents.IndexedOptionArray.copy(self, index=UNSET, content=UNSET, *, parameters=UNSET) .. _ak-contents-indexedoptionarray-__copy__: .. py:method:: ak.contents.IndexedOptionArray.__copy__(self) .. _ak-contents-indexedoptionarray-__deepcopy__: .. py:method:: ak.contents.IndexedOptionArray.__deepcopy__(self, memo) .. _ak-contents-indexedoptionarray-simplified: .. py:method:: ak.contents.IndexedOptionArray.simplified(cls, index, content, *, parameters=None) .. _ak-contents-indexedoptionarray-_form_with_key: .. py:method:: ak.contents.IndexedOptionArray._form_with_key(self, getkey) .. _ak-contents-indexedoptionarray-_form_with_key_path: .. py:method:: ak.contents.IndexedOptionArray._form_with_key_path(self, path) .. _ak-contents-indexedoptionarray-_to_buffers: .. py:method:: ak.contents.IndexedOptionArray._to_buffers(self, form, getkey, container, backend, byteorder) .. _ak-contents-indexedoptionarray-_to_typetracer: .. py:method:: ak.contents.IndexedOptionArray._to_typetracer(self, forget_length) .. _ak-contents-indexedoptionarray-_touch_data: .. py:method:: ak.contents.IndexedOptionArray._touch_data(self, recursive) .. _ak-contents-indexedoptionarray-_touch_shape: .. py:method:: ak.contents.IndexedOptionArray._touch_shape(self, recursive) .. _ak-contents-indexedoptionarray-length: .. py:attribute:: ak.contents.IndexedOptionArray.length .. _ak-contents-indexedoptionarray-__repr__: .. py:method:: ak.contents.IndexedOptionArray.__repr__(self) .. _ak-contents-indexedoptionarray-_repr: .. py:method:: ak.contents.IndexedOptionArray._repr(self, indent, pre, post) .. _ak-contents-indexedoptionarray-to_indexedoptionarray64: .. py:method:: ak.contents.IndexedOptionArray.to_IndexedOptionArray64(self) .. _ak-contents-indexedoptionarray-to_bytemaskedarray: .. py:method:: ak.contents.IndexedOptionArray.to_ByteMaskedArray(self, valid_when) .. _ak-contents-indexedoptionarray-to_bitmaskedarray: .. py:method:: ak.contents.IndexedOptionArray.to_BitMaskedArray(self, valid_when, lsb_order) .. _ak-contents-indexedoptionarray-mask_as_bool: .. py:method:: ak.contents.IndexedOptionArray.mask_as_bool(self, valid_when=True) .. _ak-contents-indexedoptionarray-_getitem_nothing: .. py:method:: ak.contents.IndexedOptionArray._getitem_nothing(self) .. _ak-contents-indexedoptionarray-_is_getitem_at_placeholder: .. py:method:: ak.contents.IndexedOptionArray._is_getitem_at_placeholder(self) .. _ak-contents-indexedoptionarray-_getitem_at: .. py:method:: ak.contents.IndexedOptionArray._getitem_at(self, where) .. _ak-contents-indexedoptionarray-_getitem_range: .. py:method:: ak.contents.IndexedOptionArray._getitem_range(self, start, stop) .. _ak-contents-indexedoptionarray-_getitem_field: .. py:method:: ak.contents.IndexedOptionArray._getitem_field(self, where, only_fields=()) .. _ak-contents-indexedoptionarray-_getitem_fields: .. py:method:: ak.contents.IndexedOptionArray._getitem_fields(self, where, only_fields=()) .. _ak-contents-indexedoptionarray-_carry: .. py:method:: ak.contents.IndexedOptionArray._carry(self, carry, allow_lazy) .. _ak-contents-indexedoptionarray-_nextcarry_outindex: .. py:method:: ak.contents.IndexedOptionArray._nextcarry_outindex(self) .. _ak-contents-indexedoptionarray-_getitem_next_jagged_generic: .. py:method:: ak.contents.IndexedOptionArray._getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, tail) .. _ak-contents-indexedoptionarray-_getitem_next_jagged: .. py:method:: ak.contents.IndexedOptionArray._getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail) .. _ak-contents-indexedoptionarray-_getitem_next: .. py:method:: ak.contents.IndexedOptionArray._getitem_next(self, head, tail, advanced) .. _ak-contents-indexedoptionarray-project: .. py:method:: ak.contents.IndexedOptionArray.project(self, mask=None) .. _ak-contents-indexedoptionarray-_offsets_and_flattened: .. py:method:: ak.contents.IndexedOptionArray._offsets_and_flattened(self, axis, depth) .. _ak-contents-indexedoptionarray-_mergeable_next: .. py:method:: ak.contents.IndexedOptionArray._mergeable_next(self, other, mergebool) .. _ak-contents-indexedoptionarray-_merging_strategy: .. py:method:: ak.contents.IndexedOptionArray._merging_strategy(self, others) .. _ak-contents-indexedoptionarray-_reverse_merge: .. py:method:: ak.contents.IndexedOptionArray._reverse_merge(self, other) .. _ak-contents-indexedoptionarray-_mergemany: .. py:method:: ak.contents.IndexedOptionArray._mergemany(self, others) .. _ak-contents-indexedoptionarray-_fill_none: .. py:method:: ak.contents.IndexedOptionArray._fill_none(self, value) .. _ak-contents-indexedoptionarray-_local_index: .. py:method:: ak.contents.IndexedOptionArray._local_index(self, axis, depth) .. _ak-contents-indexedoptionarray-_is_subrange_equal: .. py:method:: ak.contents.IndexedOptionArray._is_subrange_equal(self, starts, stops, length, sorted=True) .. _ak-contents-indexedoptionarray-_numbers_to_type: .. py:method:: ak.contents.IndexedOptionArray._numbers_to_type(self, name, including_unknown) .. _ak-contents-indexedoptionarray-_is_unique: .. py:method:: ak.contents.IndexedOptionArray._is_unique(self, negaxis, starts, parents, outlength) .. _ak-contents-indexedoptionarray-_unique: .. py:method:: ak.contents.IndexedOptionArray._unique(self, negaxis, starts, parents, outlength) .. _ak-contents-indexedoptionarray-_rearrange_nextshifts: .. py:method:: ak.contents.IndexedOptionArray._rearrange_nextshifts(self, nextparents, shifts) .. _ak-contents-indexedoptionarray-_rearrange_prepare_next: .. py:method:: ak.contents.IndexedOptionArray._rearrange_prepare_next(self, parents) .. _ak-contents-indexedoptionarray-_argsort_next: .. py:method:: ak.contents.IndexedOptionArray._argsort_next(self, negaxis, starts, shifts, parents, outlength, ascending, stable) .. _ak-contents-indexedoptionarray-_sort_next: .. py:method:: ak.contents.IndexedOptionArray._sort_next(self, negaxis, starts, parents, outlength, ascending, stable) .. _ak-contents-indexedoptionarray-_reduce_next: .. py:method:: ak.contents.IndexedOptionArray._reduce_next(self, reducer, negaxis, starts, shifts, parents, outlength, mask, keepdims, behavior) .. _ak-contents-indexedoptionarray-_combinations: .. py:method:: ak.contents.IndexedOptionArray._combinations(self, n, replacement, recordlookup, parameters, axis, depth) .. _ak-contents-indexedoptionarray-_validity_error: .. py:method:: ak.contents.IndexedOptionArray._validity_error(self, path) .. _ak-contents-indexedoptionarray-_nbytes_part: .. py:method:: ak.contents.IndexedOptionArray._nbytes_part(self) .. _ak-contents-indexedoptionarray-_pad_none: .. py:method:: ak.contents.IndexedOptionArray._pad_none(self, target, axis, depth, clip) .. _ak-contents-indexedoptionarray-_to_arrow: .. py:method:: ak.contents.IndexedOptionArray._to_arrow(self, pyarrow, mask_node, validbytes, length, options) .. _ak-contents-indexedoptionarray-_to_cudf: .. py:method:: ak.contents.IndexedOptionArray._to_cudf(self, cudf, mask, length) .. _ak-contents-indexedoptionarray-_to_backend_array: .. py:method:: ak.contents.IndexedOptionArray._to_backend_array(self, allow_missing, backend) .. _ak-contents-indexedoptionarray-_remove_structure: .. py:method:: ak.contents.IndexedOptionArray._remove_structure(self, backend, options) .. _ak-contents-indexedoptionarray-_drop_none: .. py:method:: ak.contents.IndexedOptionArray._drop_none(self) .. _ak-contents-indexedoptionarray-_recursively_apply: .. py:method:: ak.contents.IndexedOptionArray._recursively_apply(self, action, depth, depth_context, lateral_context, options) .. _ak-contents-indexedoptionarray-to_packed: .. py:method:: ak.contents.IndexedOptionArray.to_packed(self, recursive=True) .. _ak-contents-indexedoptionarray-_to_list: .. py:method:: ak.contents.IndexedOptionArray._to_list(self, behavior, json_conversions) .. _ak-contents-indexedoptionarray-_to_backend: .. py:method:: ak.contents.IndexedOptionArray._to_backend(self, backend) .. _ak-contents-indexedoptionarray-_is_equal_to: .. py:method:: ak.contents.IndexedOptionArray._is_equal_to(self, other, index_dtype, numpyarray, all_parameters) .. _ak-contents-indexedoptionarray-_trim: .. py:method:: ak.contents.IndexedOptionArray._trim(self)