Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Series.dropna#

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

Return a new Series with missing values removed.

See theUser Guide for more on which values areconsidered missing, and how to work with missing data.

Parameters:
axis{0 or ‘index’}

Unused. Parameter needed for compatibility with DataFrame.

inplacebool, default False

If True, do operation inplace and return None.

howstr, optional

Not in use. Kept for compatibility.

ignore_indexbool, defaultFalse

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

Added in version 2.0.0.

Returns:
Series or None

Series with NA entries dropped from it or None ifinplace=True.

See also

Series.isna

Indicate missing values.

Series.notna

Indicate existing (non-missing) values.

Series.fillna

Replace missing values.

DataFrame.dropna

Drop rows or columns which contain NA values.

Index.dropna

Drop missing indices.

Examples

>>>ser=pd.Series([1.,2.,np.nan])>>>ser0    1.01    2.02    NaNdtype: float64

Drop NA values from a Series.

>>>ser.dropna()0    1.01    2.0dtype: float64

Empty strings are not considered NA values.None is considered anNA value.

>>>ser=pd.Series([np.nan,2,pd.NaT,'',None,'I stay'])>>>ser0       NaN1         22       NaT34      None5    I staydtype: object>>>ser.dropna()1         235    I staydtype: object

[8]ページ先頭

©2009-2025 Movatter.jp