Skip to content

Scalar

arro3.core.Scalar

An arrow Scalar.

field property

field: Field

Access the field stored on this Scalar.

Note that this field usually will not have a name associated, but it may have metadata that signifies that this scalar is an extension (user-defined typed) scalar.

is_valid property

is_valid: bool

Return True if this scalar is not null.

type property

type: DataType

Access the type of this scalar.

__arrow_c_array__

__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.array() to convert this Scalar into a pyarrow Array, without copying memory. The generated array is guaranteed to have length 1.

as_py

as_py() -> Any

Convert this scalar to a pure-Python object.

cast

cast(target_type: ArrowSchemaExportable) -> Scalar

Cast scalar to another data type

Parameters:

from_arrow classmethod

from_arrow(input: ArrowArrayExportable) -> Scalar

Construct this from an existing Arrow Scalar.

It can be called on anything that exports the Arrow data interface (has a __arrow_c_array__ method) and returns an array with a single element.

Parameters:

Returns:

from_arrow_pycapsule classmethod

from_arrow_pycapsule(schema_capsule, array_capsule) -> Scalar

Construct this object from bare Arrow PyCapsules