cudf.Series.to_pandas#

Series.to_pandas(index=True, nullable=False, **kwargs)#

Convert to a Pandas Series.

Parameters
indexBoolean, Default True

If index is True, converts the index of cudf.Series and sets it to the pandas.Series. If index is False, no index conversion is performed and pandas.Series will assign a default index.

nullableBoolean, Default False

If nullable is True, the resulting series will be having a corresponding nullable Pandas dtype. If nullable is False, the resulting series will either convert null values to np.nan or None depending on the dtype.

Returns
outPandas Series

Examples

>>> 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 parameter can be used to control whether dtype can be Pandas Nullable or not:

>>> 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