Skip to content

Conversion

Moving an array between the eager and lazy implementations. See Converting between implementations for a guide.

convert

convert(array: SomeLazyFrameLabeledArray, *, implementation: Literal[LAZY]) -> SomeLazyFrameLabeledArray
convert(array: SomeEagerFrameLabeledArray, *, implementation: Literal[EAGER]) -> SomeEagerFrameLabeledArray
convert(array: LazyFrameLabeledArray[ExternalFrameType, Any], *, implementation: Literal[EAGER]) -> EagerFrameLabeledArray[ExternalFrameType, NumpyArray]
convert(array: EagerFrameLabeledArray[DataFrame[DataFrame], Any], *, implementation: Literal[LAZY]) -> LazyFrameLabeledArray[DataFrame[DataFrame], LazyFrame[LazyFrame]]
convert(array: EagerFrameLabeledArray[ExternalFrameType, Any], *, implementation: Literal[LAZY]) -> LazyFrameLabeledArray[ExternalFrameType, Any]
convert(array: FrameLabeledArray[LabelFrameType, ValueArrayType], *, implementation: Literal[LAZY]) -> LazyFrameLabeledArray[LabelFrameType, Any]
convert(array: FrameLabeledArray[LabelFrameType, SomeValueArray], *, implementation: Literal[EAGER]) -> EagerFrameLabeledArray[LabelFrameType, SomeValueArray]
convert(array: FrameLabeledArray[LabelFrameType, Any], *, implementation: Literal[EAGER]) -> EagerFrameLabeledArray[LabelFrameType, Any]
convert(array: FrameLabeledArray[Any, Any], *, implementation: FrameLabeledArrayImplementation = EAGER) -> FrameLabeledArray[Any, Any]

Convert a FrameLabeledArray to a different implementation.

If the array is already in the target implementation, it is returned unchanged without copying any data.

Parameters:

Name Type Description Default
array FrameLabeledArray[Any, Any]

The array to convert.

required
implementation FrameLabeledArrayImplementation

The target implementation. Defaults to EAGER.

EAGER

Returns:

Type Description
FrameLabeledArray[Any, Any]

The array in the target implementation.

Implementation selection

The target implementation is chosen with the FrameLabeledArrayImplementation enum, whose members EAGER and LAZY are re-exported at the top level as pld.EAGER and pld.LAZY.

FrameLabeledArrayImplementation

Bases: StrEnum

Selects which implementation of the protocol to build or convert to.

EAGER class-attribute instance-attribute

EAGER = auto()

The array-backed implementation that resolves every operation immediately.

LAZY class-attribute instance-attribute

LAZY = auto()

The DataFrame-backed implementation that evaluates operations lazily.