cudf.Series.dropna#

Series.dropna(axis=0, inplace=False, how=None, ignore_index: bool = False)[source]#

Return a Series with null values removed.

Parameters:
axis{0 or ‘index’}, default 0

There is only one axis to drop values from.

inplacebool, default False

If True, do operation inplace and return None.

howstr, optional

Not in use. Kept for compatibility.

ignore_indexbool, default False

If True, the resulting axis will be labeled 0, 1, …, n - 1.

Returns:
Series

Series with null entries dropped from it.

See also

Series.isna

Indicate null values.

Series.notna

Indicate non-null values.

Series.fillna

Replace null values.

cudf.DataFrame.dropna

Drop rows or columns which contain null values.

cudf.Index.dropna

Drop null indices.

Examples

>>> import cudf
>>> ser = cudf.Series([1, 2, None])
>>> ser
0       1
1       2
2    <NA>
dtype: int64

Drop null values from a Series.

>>> ser.dropna()
0    1
1    2
dtype: int64

Keep the Series with valid entries in the same variable.

>>> ser.dropna(inplace=True)
>>> ser
0    1
1    2
dtype: int64

Empty strings are not considered null values. None is considered a null value.

>>> ser = cudf.Series(['', None, 'abc'])
>>> ser
0
1    <NA>
2     abc
dtype: object
>>> ser.dropna()
0
2    abc
dtype: object