pyarrow.compute.list_slice#

pyarrow.compute.list_slice(lists, /, start, stop=None, step=1, return_fixed_size_list=None, *, options=None, memory_pool=None)#

Compute slice of list-like array.

lists must have a list-like type. For each list element, compute a slice, returning a new list array. A variable or fixed size list array is returned, depending on options.

Parameters:
listsArray-like or scalar-like

Argument to compute function.

startint

Index to start slicing inner list elements (inclusive).

stopOptional[int], default None

If given, index to stop slicing at (exclusive). If not given, slicing will stop at the end. (NotImplemented)

stepint, default 1

Slice step.

return_fixed_size_listOptional[bool], default None

Whether to return a FixedSizeListArray. If true _and_ stop is after a list element’s length, nulls will be appended to create the requested slice size. The default of None will return the same type which was passed in.

optionspyarrow.compute.ListSliceOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.