ArrayReader¶
arro3.core.ArrayReader ¶
A stream of Arrow Array
s.
This is similar to the RecordBatchReader
but each
item yielded from the stream is an Array
, not a
RecordBatch
.
__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__ ¶
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_arrays
classmethod
¶
from_arrays(
field: ArrowSchemaExportable, arrays: Sequence[ArrowArrayExportable]
) -> ArrayReader
Construct an ArrayReader from existing data.
Parameters:
-
field
(ArrowSchemaExportable
) –The Arrow field that describes the sequence of array data.
-
arrays
(Sequence[ArrowArrayExportable]
) –A sequence (list or tuple) of Array data.
from_arrow
classmethod
¶
from_arrow(input: ArrowArrayExportable | ArrowStreamExportable) -> ArrayReader
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
.