Skip to content

ArrayReader

arro3.core.ArrayReader

A stream of Arrow Arrays.

This is similar to the RecordBatchReader but each item yielded from the stream is an Array, not a RecordBatch.

closed property

closed: bool

Returns true if this reader has already been consumed.

field property

field: Field

Access the field of this reader.

__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 ArrayReader. Then the consumer can ask the producer (in __arrow_c_stream__) to cast the exported data to a supported data type.

__arrow_c_stream__

__arrow_c_stream__(requested_schema: object | None = None) -> 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.chunked_array() to convert this ArrayReader to a pyarrow ChunkedArray, without copying memory.

from_arrow classmethod

Construct this from an existing Arrow object.

It can be called on anything that exports the Arrow stream interface (has an __arrow_c_stream__ method), such as a Table or ArrayReader.

from_arrow_pycapsule classmethod

from_arrow_pycapsule(capsule) -> ArrayReader

Construct this object from a bare Arrow PyCapsule

from_stream classmethod

from_stream(data: ArrowStreamExportable) -> ArrayReader

Construct this from an existing Arrow object.

This is an alias of and has the same behavior as [from_arrow][arro3.ArrayReader.from_arrow], but is included for parity with pyarrow.RecordBatchReader.

read_all

read_all() -> ChunkedArray

Read all batches from this stream into a ChunkedArray.

read_next_array

read_next_array() -> Array

Read the next array from this stream.