用法:
classmethod Series.from_pandas(s, nan_as_null=None)
從 Pandas 係列轉換。
- s: Pandas 係列對象
必須轉換為 cuDF Series 的 Pandas Series 對象。
- nan_as_null:布爾,默認無
如果
None
/True
,將np.nan
值轉換為null
值。如果False
,保持np.nan
值不變。
- 無效輸入類型的 TypeError。
參數:
拋出:
例子:
>>> import cudf >>> import pandas as pd >>> import numpy as np >>> data = [10, 20, 30, np.nan] >>> pds = pd.Series(data) >>> 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
相關用法
- Python cudf.Series.from_categorical用法及代碼示例
- Python cudf.Series.from_masked_array用法及代碼示例
- Python cudf.Series.from_arrow用法及代碼示例
- Python cudf.Series.floordiv用法及代碼示例
- Python cudf.Series.fillna用法及代碼示例
- Python cudf.Series.factorize用法及代碼示例
- Python cudf.Series.first用法及代碼示例
- Python cudf.Series.floor用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.Series.min用法及代碼示例
- Python cudf.Series.nlargest用法及代碼示例
- Python cudf.Series.to_frame用法及代碼示例
- Python cudf.Series.mask用法及代碼示例
- Python cudf.Series.notnull用法及代碼示例
- Python cudf.Series.isnull用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.from_pandas。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。