互操作#

class pylibcudf.interop.ColumnMetadata(name: str = '', children_meta: list[~pylibcudf.interop.ColumnMetadata] = <factory>)#

与列相关的元数据。

这是 cudf::column_metadata 的 Python 表示形式。

pylibcudf.interop.from_arrow(pyarrow_object, *, DataType data_type=None)#
pylibcudf.interop.from_arrow(pyarrow_object: DataType)
pylibcudf.interop.from_arrow(pyarrow_object: Table, *, data_type=None)
pylibcudf.interop.from_arrow(pyarrow_object: Scalar, *, data_type=None)
pylibcudf.interop.from_arrow(pyarrow_object: Array, *, data_type=None)

从 pyarrow 对象创建 cudf 对象。

参数:
pyarrow_objectUnion[pyarrow.Array, pyarrow.Table, pyarrow.Scalar]

要转换的 PyArrow 对象。

返回:
Union[Table, Scalar]

转换为 cudf 中对应输入类型的对象。

pylibcudf.interop.from_dlpack(managed_tensor) Table#

将 DLPack DLTensor 转换为 cudf 表。

详情请参阅 cudf::from_dlpack()

参数:
managed_tensorPyCapsule

一个 1D 或 2D 列主序(Fortran 顺序)张量。

返回:

包含张量数据副本的表。

pylibcudf.interop.to_arrow(cudf_object, metadata=None)#
pylibcudf.interop.to_arrow(cudf_object: DataType, **kwargs)
pylibcudf.interop.to_arrow(cudf_object: Table, metadata=None)
pylibcudf.interop.to_arrow(cudf_object: Column, metadata=None)
pylibcudf.interop.to_arrow(cudf_object: Scalar, metadata=None)

转换为 PyArrow 对象。

参数:
cudf_objectUnion[Column, Table, Scalar]

要转换的 cudf 对象。

metadatalist

要附加到表列的元数据。

返回:
Union[pyarrow.Array, pyarrow.Table, pyarrow.Scalar]

转换为 PyArrow 中对应输入类型的对象。

pylibcudf.interop.to_dlpack(Table input)#

将 cudf 表转换为 DLPack DLTensor。

详情请参阅 cudf::to_dlpack()

参数:
inputTable

一个 1D 或 2D 列主序(Fortran 顺序)张量。

返回:
PyCapsule

包含表数据副本的 1D 或 2D DLPack 张量,或 nullptr。