cudf.DataFrame.to_arrow#

DataFrame.to_arrow(preserve_index=None)#

Convert to a PyArrow Table.

Parameters:
preserve_indexbool, optional

whether index column and its meta data needs to be saved or not. The default of None will store the index as a column, except for a RangeIndex which is stored as metadata only. Setting preserve_index to True will force a RangeIndex to be materialized.

Returns:
PyArrow Table

Examples

>>> import cudf
>>> df = cudf.DataFrame(
...     {"a":[1, 2, 3], "b":[4, 5, 6]}, index=[1, 2, 3])
>>> df.to_arrow()
pyarrow.Table
a: int64
b: int64
index: int64
----
a: [[1,2,3]]
b: [[4,5,6]]
index: [[1,2,3]]
>>> df.to_arrow(preserve_index=False)
pyarrow.Table
a: int64
b: int64
----
a: [[1,2,3]]
b: [[4,5,6]]