cudf.Index.from_pandas#
- classmethod Index.from_pandas(index, nan_as_null=None)#
Convert from a Pandas Index.
- Parameters
- indexPandas Index object
A Pandas Index object which has to be converted to cuDF Index.
- nan_as_nullbool, Default None
If
None
/True
, convertsnp.nan
values tonull
values. IfFalse
, leavesnp.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] >>> pdi = pd.Index(data) >>> cudf.Index.from_pandas(pdi) Float64Index([10.0, 20.0, 30.0, <NA>], dtype='float64') >>> cudf.Index.from_pandas(pdi, nan_as_null=False) Float64Index([10.0, 20.0, 30.0, nan], dtype='float64')