hipdf.Series.to_pandas#
22 min read time
- Series.to_pandas(*, index: bool = True, nullable: bool = False, arrow_type: bool = False) Series#
Convert to a pandas Series.
Parameters#
- indexBoolean, Default True
If
indexisTrue, converts the index of cudf.Series and sets it to the pandas.Series. IfindexisFalse, no index conversion is performed and pandas.Series will assign a default index.- nullableBoolean, Default False
If
nullableisTrue, the resulting series will be having a corresponding nullable Pandas dtype. If there is no corresponding nullable Pandas dtype present, the resulting dtype will be a regular pandas dtype. IfnullableisFalse, the resulting series will either convert null values tonp.nanorNonedepending on the dtype.- arrow_typebool, Default False
Return the Series with a
pandas.ArrowDtype
Returns#
out : pandas Series
Notes#
nullable and arrow_type cannot both be set to
TrueExamples#
>>> import cudf >>> ser = cudf.Series([-3, 2, 0]) >>> pds = ser.to_pandas() >>> pds 0 -3 1 2 2 0 dtype: int64 >>> type(pds) <class 'pandas.core.series.Series'>
nullable=Trueconverts the result to pandas nullable types:>>> ser = cudf.Series([10, 20, None, 30]) >>> ser 0 10 1 20 2 <NA> 3 30 dtype: int64 >>> ser.to_pandas(nullable=True) 0 10 1 20 2 <NA> 3 30 dtype: Int64 >>> ser.to_pandas(nullable=False) 0 10.0 1 20.0 2 NaN 3 30.0 dtype: float64
arrow_type=Trueconverts the result topandas.ArrowDtype:>>> ser.to_pandas(arrow_type=True) 0 10 1 20 2 <NA> 3 30 dtype: int64[pyarrow]