interop#

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

Metadata associated with a column.

This is the Python representation of cudf::column_metadata.

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)

Create a cudf object from a pyarrow object.

Parameters:
pyarrow_objectUnion[pyarrow.Array, pyarrow.Table, pyarrow.Scalar]

The PyArrow object to convert.

Returns:
Union[Table, Scalar]

The converted object of type corresponding to the input type in cudf.

pylibcudf.interop.from_dlpack(managed_tensor) Table#

Convert a DLPack DLTensor into a cudf table.

For details, see cudf::from_dlpack()

Parameters:
managed_tensorPyCapsule

A 1D or 2D column-major (Fortran order) tensor.

Returns:
Table

Table with a copy of the tensor data.

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)

Convert to a PyArrow object.

Parameters:
cudf_objectUnion[Column, Table, Scalar]

The cudf object to convert.

metadatalist

The metadata to attach to the columns of the table.

Returns:
Union[pyarrow.Array, pyarrow.Table, pyarrow.Scalar]

The converted object of type corresponding to the input type in PyArrow.

pylibcudf.interop.to_dlpack(Table input)#

Convert a cudf table into a DLPack DLTensor.

For details, see cudf::to_dlpack()

Parameters:
inputTable

A 1D or 2D column-major (Fortran order) tensor.

Returns:
PyCapsule

1D or 2D DLPack tensor with a copy of the table data, or nullptr.