Skip to content

arro3.compute

arro3.compute

add

Perform lhs + rhs, returning an error on overflow

add_wrapping

add_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array

Perform lhs + rhs, wrapping on overflow for integer data types.

can_cast_types

can_cast_types(
    from_type: ArrowSchemaExportable, to_type: ArrowSchemaExportable
) -> bool

Return true if a value of type from_type can be cast into a value of to_type.

Parameters:

Returns:

  • bool

    True if can be casted.

cast

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:

Returns:

dictionary_encode

dictionary_encode(
    array: ArrowArrayExportable | ArrowStreamExportable,
) -> Array | ArrayReader

Dictionary-encode array.

Return a dictionary-encoded version of the input array. This function does nothing if the input is already a dictionary array.

Note: for stream input, each output array will not necessarily have the same dictionary.

Parameters:

Returns:

div

Perform lhs / rhs

filter

Returns a filtered values array where the corresponding elements of predicate are true.

If input is an Array, an Array will be returned. If input is a ChunkedArray or ArrayReader, an ArrayReader will be returned.

is_not_null

Returns a non-null boolean-typed array with whether each value of the array is not null.

If input is an Array, an Array will be returned. If input is a ChunkedArray or ArrayReader, an ArrayReader will be returned.

Parameters:

Returns:

is_null

Returns a non-null boolean-typed array with whether each value of the array is null.

If input is an Array, an Array will be returned. If input is a ChunkedArray or ArrayReader, an ArrayReader will be returned.

Parameters:

Returns:

max

Returns the max of values in the array.

min

Returns the min of values in the array.

mul

Perform lhs * rhs, returning an error on overflow

mul_wrapping

mul_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array

Perform lhs * rhs, wrapping on overflow for integer data types.

neg

neg(array: ArrowArrayExportable) -> Array

Negates each element of array, returning an error on overflow

neg_wrapping

neg_wrapping(array: ArrowArrayExportable) -> Array

Negates each element of array, wrapping on overflow for integer data types.

rem

Perform lhs % rhs

sub

Perform lhs - rhs, returning an error on overflow

sub_wrapping

sub_wrapping(lhs: ArrowArrayExportable, rhs: ArrowArrayExportable) -> Array

Perform lhs - rhs, wrapping on overflow for integer data types.

sum

Returns the sum of values in the array.

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:

Returns:

  • Array

    The selected arrow data.