cudf.DataFrame.nans_to_nulls#
- DataFrame.nans_to_nulls()[source]#
Convert nans (if any) to nulls
- Returns:
- DataFrame or Series
Examples
Series
>>> import cudf, numpy as np >>> series = cudf.Series([1, 2, np.nan, None, 10], nan_as_null=False) >>> series 0 1.0 1 2.0 2 NaN 3 <NA> 4 10.0 dtype: float64 >>> series.nans_to_nulls() 0 1.0 1 2.0 2 <NA> 3 <NA> 4 10.0 dtype: float64
DataFrame
>>> df = cudf.DataFrame() >>> df['a'] = cudf.Series([1, None, np.nan], nan_as_null=False) >>> df['b'] = cudf.Series([None, 3.14, np.nan], nan_as_null=False) >>> df a b 0 1.0 <NA> 1 <NA> 3.14 2 NaN NaN >>> df.nans_to_nulls() a b 0 1.0 <NA> 1 <NA> 3.14 2 <NA> <NA>