RecordBatch¶
arro3.core.RecordBatch ¶
A Python-facing Arrow record batch.
This is a wrapper around a [RecordBatch].
column_names ¶
Names of the Table or RecordBatch columns.
columns ¶
List of all columns in numerical order.
num_columns ¶
num_columns: int = <attribute 'num_columns' of 'arro3.core._core.RecordBatch' objects>
Number of columns in this RecordBatch.
num_rows ¶
num_rows: int = <attribute 'num_rows' of 'arro3.core._core.RecordBatch' objects>
Number of rows in this RecordBatch.
shape ¶
Dimensions of the table or record batch: (#rows, #columns).
__arrow_c_array__
method descriptor
¶
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.
append_column
method descriptor
¶
append_column(
field: str | ArrowSchemaExportable, column: ArrowArrayExportable
) -> RecordBatch
Append column at end of columns.
Parameters:
-
field
(str | ArrowSchemaExportable
) –If a string is passed then the type is deduced from the column data.
-
column
(ArrowArrayExportable
) –Column data
Returns:
-
RecordBatch
–description
column
method descriptor
¶
column(i: int | str) -> ChunkedArray
Select single column from RecordBatch
equals
method descriptor
¶
equals(other: ArrowArrayExportable) -> bool
Check if contents of two record batches are equal.
Parameters:
-
other
(ArrowArrayExportable
) –RecordBatch to compare against.
Returns:
-
bool
–description
from_arrays
builtin
¶
from_arrays(
arrays: Sequence[ArrowArrayExportable], *, schema: ArrowSchemaExportable
) -> RecordBatch
Construct a RecordBatch from multiple Arrays
from_arrow
builtin
¶
from_arrow(input: ArrowArrayExportable | ArrowStreamExportable) -> RecordBatch
Construct this from an existing Arrow RecordBatch.
It can be called on anything that exports the Arrow data interface
(__arrow_c_array__
) and returns a StructArray..
Parameters:
-
input
(ArrowArrayExportable | ArrowStreamExportable
) –Arrow array to use for constructing this object
Returns:
-
RecordBatch
–Self
from_arrow_pycapsule
builtin
¶
from_arrow_pycapsule(schema_capsule, array_capsule) -> RecordBatch
Construct this object from a bare Arrow PyCapsule
from_pydict
builtin
¶
from_pydict(
mapping: dict[str, ArrowArrayExportable],
*,
metadata: ArrowSchemaExportable | None = None
) -> RecordBatch
Construct a Table or RecordBatch from Arrow arrays or columns.
Parameters:
-
mapping
(dict[str, ArrowArrayExportable]
) –A mapping of strings to Arrays.
-
metadata
(ArrowSchemaExportable | None
, default:None
) –Optional metadata for the schema (if inferred). Defaults to None.
Returns:
-
RecordBatch
–description
from_struct_array
builtin
¶
from_struct_array(struct_array: ArrowArrayExportable) -> RecordBatch
Construct a RecordBatch from a StructArray.
Each field in the StructArray will become a column in the resulting RecordBatch.
remove_column
method descriptor
¶
remove_column(i: int) -> RecordBatch
Create new RecordBatch with the indicated column removed.
Parameters:
-
i
(int
) –Index of column to remove.
Returns:
-
RecordBatch
–New record batch without the column.