arro3.compute¶
arro3.compute ¶
cast ¶
cast(
input: ArrowArrayExportable | ArrowStreamExportable,
to_type: ArrowSchemaExportable,
) -> Array | ArrayReader
Cast input
to the provided data type and return a new Array with type to_type
, if possible.
If input
is an Array, an Array
will be returned. If input
is a ChunkedArray
or ArrayReader
, an ArrayReader
will be returned.
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –Input data to cast.
-
to_type
(ArrowSchemaExportable
) –The target data type to cast to.
Returns:
-
Array | ArrayReader
–The casted Arrow data.
list_flatten ¶
list_flatten(
input: ArrowArrayExportable | ArrowStreamExportable,
) -> Array | ArrayReader
Unnest this ListArray, LargeListArray or FixedSizeListArray.
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –Input data.
Returns:
-
Array | ArrayReader
–The flattened Arrow data.
list_offsets ¶
list_offsets(
input: ArrowArrayExportable | ArrowStreamExportable, *, logical: bool = True
) -> Array | ArrayReader
Access the offsets of this ListArray or LargeListArray
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –description
-
physical
–If False, return the physical (unsliced) offsets of the provided list array. If True, adjust the list offsets for the current array slicing. Defaults to
True
.
Returns:
-
Array | ArrayReader
–description
struct_field ¶
struct_field(
values: ArrowArrayExportable, /, indices: int | Sequence[int]
) -> Array
Access a column within a StructArray by index
Parameters:
-
values
(ArrowArrayExportable
) –Argument to compute function.
-
indices
(int | Sequence[int]
) –List of indices for chained field lookup, for example [4, 1] will look up the second nested field in the fifth outer field.
Returns:
-
Array
–description
take ¶
take(values: ArrowArrayExportable, indices: ArrowArrayExportable) -> Array
Take elements by index from Array, creating a new Array from those indexes.
┌─────────────────┐ ┌─────────┐ ┌─────────────────┐
│ A │ │ 0 │ │ A │
├─────────────────┤ ├─────────┤ ├─────────────────┤
│ D │ │ 2 │ │ B │
├─────────────────┤ ├─────────┤ take(values, indices) ├─────────────────┤
│ B │ │ 3 │ ─────────────────────────▶ │ C │
├─────────────────┤ ├─────────┤ ├─────────────────┤
│ C │ │ 1 │ │ D │
├─────────────────┤ └─────────┘ └─────────────────┘
│ E │
└─────────────────┘
values array indices array result
Parameters:
-
values
(ArrowArrayExportable
) –The input Arrow data to select from.
-
indices
(ArrowArrayExportable
) –The indices within
values
to take. This must be a numeric array.
Returns:
-
Array
–The selected arrow data.