arro3.compute¶
arro3.compute ¶
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.
__array__ ¶
__array__(dtype=None, copy=None) -> NDArray
An implementation of the Array interface, for interoperability with numpy and other array libraries.
__arrow_c_array__ ¶
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.
__init__ ¶
__init__(
obj: ArrowArrayExportable | Sequence[Any],
/,
type: ArrowSchemaExportable | None = None,
) -> None
Create arro3.core.Array instance from a sequence of Python objects.
Parameters:
-
obj
(ArrowArrayExportable | Sequence[Any]
) –A sequence of input objects.
-
type
(ArrowSchemaExportable | None
, default:None
) –Explicit type to attempt to coerce to.
cast ¶
cast(target_type: ArrowSchemaExportable) -> Array
Cast array values to another data type
Parameters:
-
target_type
(ArrowSchemaExportable
) –Type to cast array to.
from_arrow
classmethod
¶
from_arrow(input: ArrowArrayExportable | ArrowStreamExportable) -> Array
Construct this object from an existing Arrow object.
It can be called on anything that exports the Arrow data interface
(__arrow_c_array__
).
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –Arrow array to use for constructing this object
Returns:
-
Array
–Self
from_arrow_pycapsule
classmethod
¶
from_arrow_pycapsule(schema_capsule, array_capsule) -> Array
Construct this object from bare Arrow PyCapsules
from_numpy
classmethod
¶
Construct an Array from a numpy ndarray
slice ¶
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_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_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
, but is included for parity
with pyarrow.RecordBatchReader
.
list_flatten ¶
list_flatten(
input: ArrowArrayExportable | ArrowStreamExportable,
) -> Array | ArrayReader
Unnest this ListArray, LargeListArray or FixedSizeListArray.
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –description
Returns:
-
Array | ArrayReader
–description
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 ¶
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