Skip to content

Array

arro3.core.Array

An Arrow Array.

field property

field: Field

Access the field stored on this Array.

Note that this field usually will not have a name associated, but it may have metadata that signifies that this array is an extension (user-defined typed) array.

nbytes property

nbytes: int

The number of bytes in this Array.

null_count property

null_count: int

The number of null values in this Array.

type property

type: DataType

The data type of this array.

__arrow_c_array__

__arrow_c_array__(
    requested_schema: object | None = None,
) -> tuple[object, object]

An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.

For example, you can call pyarrow.array() to convert this array into a pyarrow array, without copying memory.

__arrow_c_schema__

__arrow_c_schema__() -> object

An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.

This allows Arrow consumers to inspect the data type of this array. Then the consumer can ask the producer (in __arrow_c_array__) to cast the exported data to a supported data type.

cast

cast(target_type: ArrowSchemaExportable) -> Array

Cast array values to another data type

Parameters:

from_arrow classmethod

Construct this object from an existing Arrow object.

It can be called on anything that exports the Arrow data interface (__arrow_c_array__).

Parameters:

Returns:

from_arrow_pycapsule classmethod

from_arrow_pycapsule(schema_capsule, array_capsule) -> Array

Construct this object from bare Arrow PyCapsules

from_buffer classmethod

from_buffer(buffer: BufferProtocolExportable | Any) -> Array

Construct an Array from an object implementing the Python Buffer Protocol.

from_numpy classmethod

from_numpy(array: ndarray) -> Array

Construct an Array from a numpy ndarray

slice

slice(offset: int = 0, length: int | None = None) -> Array

Compute zero-copy slice of this array.

Parameters:

  • offset (int, default: 0 ) –

    Defaults to 0.

  • length (int | None, default: None ) –

    Defaults to None.

Returns:

  • Array

    The sliced array

take

take(indices: ArrayInput) -> Array

Take specific indices from this Array.

to_numpy

to_numpy() -> NDArray

Return a numpy copy of this array.

to_pylist

to_pylist() -> NDArray

Convert to a list of native Python objects.