Skip to content

RecordBatch

arro3.core.RecordBatch

column_names

column_names: list[str] = <attribute 'column_names' of 'arro3.core._core.RecordBatch' objects>

columns

columns: list[Array] = <attribute 'columns' of 'arro3.core._core.RecordBatch' objects>

nbytes

nbytes: int = <attribute 'nbytes' of 'arro3.core._core.RecordBatch' objects>

num_columns

num_columns: int = <attribute 'num_columns' of 'arro3.core._core.RecordBatch' objects>

num_rows

num_rows: int = <attribute 'num_rows' of 'arro3.core._core.RecordBatch' objects>

schema

schema: Schema = <attribute 'schema' of 'arro3.core._core.RecordBatch' objects>

shape

shape: tuple[int, int] = <attribute 'shape' of 'arro3.core._core.RecordBatch' objects>

__arrow_c_array__ method descriptor

__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.record_batch() to convert this RecordBatch into a pyarrow RecordBatch, without copying memory.

append_column method descriptor

append_column(
    field: str | ArrowSchemaExportable, column: ArrowArrayExportable
) -> RecordBatch

Append column at end of columns.

Parameters:

Returns:

column method descriptor

column(i: int | str) -> ChunkedArray

Select single column from Table or RecordBatch.

Parameters:

  • i (int | str) –

    The index or name of the column to retrieve.

Returns:

equals method descriptor

equals(other: ArrowArrayExportable) -> bool

Check if contents of two record batches are equal.

Parameters:

Returns:

  • bool

    description

field method descriptor

field(i: int | str) -> Field

Select a schema field by its column name or numeric index.

Parameters:

  • i (int | str) –

    The index or name of the field to retrieve.

Returns:

from_arrays builtin

from_arrays(
    arrays: Sequence[ArrowArrayExportable], *, schema: ArrowSchemaExportable
) -> RecordBatch

Construct a RecordBatch from multiple Arrays

Parameters:

Returns:

from_arrow builtin

Construct this from an existing Arrow RecordBatch.

It can be called on anything that exports the Arrow data interface (has a __arrow_c_array__ method) and returns a StructArray..

Parameters:

Returns:

from_arrow_pycapsule builtin

from_arrow_pycapsule(schema_capsule, array_capsule) -> RecordBatch

Construct this object from bare Arrow PyCapsules

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:

Returns:

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.

Parameters:

Returns:

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:

select method descriptor

select(columns: list[int] | list[str]) -> RecordBatch

Select columns of the RecordBatch.

Returns a new RecordBatch with the specified columns, and metadata preserved.

Parameters:

  • columns (list[int] | list[str]) –

    The column names or integer indices to select.

Returns:

set_column method descriptor

set_column(
    i: int, field: str | ArrowSchemaExportable, column: ArrowArrayExportable
) -> RecordBatch

Replace column in RecordBatch at position.

Parameters:

Returns:

slice method descriptor

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

Compute zero-copy slice of this RecordBatch

Parameters:

  • offset (int, default: 0 ) –

    Offset from start of record batch to slice. Defaults to 0.

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

    Length of slice (default is until end of batch starting from offset). Defaults to None.

Returns:

take method descriptor

Select rows from a Table or RecordBatch.

Parameters:

Returns:

to_struct_array method descriptor

to_struct_array() -> Array

Convert to a struct array.

Returns:

with_schema method descriptor

with_schema(schema: ArrowSchemaExportable) -> RecordBatch

Return a RecordBatch with the provided schema.