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.
__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 Scalar into a pyarrow Array, without copying memory. The generated
array is guaranteed to have length 1.
__eq__ ¶
__eq__(other) -> bool
Check for equality with other Python objects (==
)
If other
is not an Arrow scalar, self
will be converted to a Python object
(with as_py
), and then its __eq__
method will be called.
__init__ ¶
__init__(obj: ArrayInput, /, type: None = None) -> None
__init__(obj: Any, /, type: ArrowSchemaExportable) -> None
__init__(
obj: ArrayInput | Any, /, type: ArrowSchemaExportable | None = None
) -> None
Create arro3.Scalar instance from a Python object.
Parameters:
-
obj
(ArrayInput | Any
) –An input object.
-
type
(ArrowSchemaExportable | None
, default:None
) –Explicit type to attempt to coerce to. You may pass in a
Field
totype
in order to associate extension metadata with this array.
cast ¶
cast(target_type: ArrowSchemaExportable) -> Scalar
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:
-
input
(ArrowArrayExportable
) –Arrow scalar to use for constructing this object
Returns:
-
Scalar
–new Scalar