Skip to content

Schema

arro3.core.Schema

An arrow Schema.

metadata property

metadata: dict[bytes, bytes]

The schema's metadata.

Returns:

metadata_str property

metadata_str: dict[str, str]

The schema's metadata where keys and values are str, not bytes.

Returns:

names property

names: list[str]

The schema's field names.

types property

types: list[DataType]

The schema's field types.

Returns:

__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.

For example, you can call pyarrow.schema() to convert this array into a pyarrow schema, without copying memory.

append

append(field: ArrowSchemaExportable) -> Schema

Append a field at the end of the schema.

In contrast to Python's list.append() it does return a new object, leaving the original Schema unmodified.

Parameters:

Returns:

empty_table

empty_table() -> Table

Provide an empty table according to the schema.

Returns:

equals

equals(other: ArrowSchemaExportable) -> bool

Test if this schema is equal to the other

Parameters:

Returns:

  • bool

    description

field

field(i: int | str) -> Field

Select a field by its column name or numeric index.

Parameters:

Returns:

from_arrow classmethod

from_arrow(input: ArrowSchemaExportable) -> Schema

Construct this from an existing Arrow object

Parameters:

Returns:

from_arrow_pycapsule classmethod

from_arrow_pycapsule(capsule) -> Schema

Construct this object from a bare Arrow PyCapsule

get_all_field_indices

get_all_field_indices(name: str) -> list[int]

Return sorted list of indices for the fields with the given name.

Parameters:

  • name (str) –

    description

Returns:

get_field_index

get_field_index(name: str) -> int

Return index of the unique field with the given name.

Parameters:

  • name (str) –

    description

Returns:

  • int

    description

insert

insert(i: int, field: ArrowSchemaExportable) -> Schema

Add a field at position i to the schema.

Parameters:

Returns:

remove

remove(i: int) -> Schema

Remove the field at index i from the schema.

Parameters:

  • i (int) –

    description

Returns:

remove_metadata

remove_metadata() -> Schema

Create new schema without metadata, if any

Returns:

set

set(i: int, field: ArrowSchemaExportable) -> Schema

Replace a field at position i in the schema.

Parameters:

Returns:

with_metadata

with_metadata(metadata: dict[str, str] | dict[bytes, bytes]) -> Schema

Add metadata as dict of string keys and values to Schema.

Parameters:

Returns: