cudf.Series.from_pandas#

classmethod Series.from_pandas(s: Series, nan_as_null=_NoDefault.no_default)[source]#

Convert from a Pandas Series.

Parameters:
sPandas Series object

A Pandas Series object which has to be converted to cuDF Series.

nan_as_nullbool, Default None

If None/True, converts np.nan values to null values. If False, leaves np.nan values as is.

Raises:
TypeError for invalid input type.

Examples

>>> import cudf
>>> import pandas as pd
>>> import numpy as np
>>> data = [10, 20, 30, np.nan]
>>> pds = pd.Series(data, dtype='float64')
>>> cudf.Series.from_pandas(pds)
0    10.0
1    20.0
2    30.0
3    <NA>
dtype: float64
>>> cudf.Series.from_pandas(pds, nan_as_null=False)
0    10.0
1    20.0
2    30.0
3     NaN
dtype: float64