cudf.Index.to_pandas#
- Index.to_pandas(*, nullable: bool = False, arrow_type: bool = False) Index [source]#
Convert to a Pandas Index.
- Parameters:
- nullablebool, Default False
If
nullable
isTrue
, the resulting index will have a corresponding nullable Pandas dtype. If there is no corresponding nullable Pandas dtype present, the resulting dtype will be a regular pandas dtype. Ifnullable
isFalse
, the resulting index will either convert null values tonp.nan
orNone
depending on the dtype.- arrow_typebool, Default False
Return the Index with a
pandas.ArrowDtype
Notes
nullable and arrow_type cannot both be set to
True
Examples
>>> import cudf >>> idx = cudf.Index([-3, 10, 15, 20]) >>> idx Index([-3, 10, 15, 20], dtype='int64') >>> idx.to_pandas() Index([-3, 10, 15, 20], dtype='int64') >>> type(idx.to_pandas()) <class 'pandas.core.indexes.base.Index'> >>> type(idx) <class 'cudf.core.index.Index'> >>> idx.to_pandas(arrow_type=True) Index([-3, 10, 15, 20], dtype='int64[pyarrow]')