cudf.Series.to_pandas#
- Series.to_pandas(index=True, nullable=False, **kwargs)#
Convert to a Pandas Series.
- Parameters
- indexBoolean, Default True
If
index
isTrue
, converts the index of cudf.Series and sets it to the pandas.Series. Ifindex
isFalse
, no index conversion is performed and pandas.Series will assign a default index.- nullableBoolean, Default False
If
nullable
isTrue
, 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. Ifnullable
isFalse
, the resulting series will either convert null values tonp.nan
orNone
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