Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Series.all#

Series.all(axis=0,bool_only=False,skipna=True,**kwargs)[source]#

Return whether all elements are True, potentially over an axis.

Returns True unless there at least one element within a series oralong a Dataframe axis that is False or equivalent (e.g. zero orempty).

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

Indicate which axis or axes should be reduced. ForSeries this parameteris unused and defaults to 0.

  • 0 / ‘index’ : reduce the index, return a Series whose index is theoriginal column labels.

  • 1 / ‘columns’ : reduce the columns, return a Series whose index is theoriginal index.

  • None : reduce all axes, return a scalar.

bool_onlybool, default False

Include only boolean columns. Not implemented for Series.

skipnabool, default True

Exclude NA/null values. If the entire row/column is NA and skipna isTrue, then the result will be True, as for an empty row/column.If skipna is False, then NA are treated as True, because these are notequal to zero.

**kwargsany, default None

Additional keywords have no effect but might be accepted forcompatibility with NumPy.

Returns:
scalar or Series

If level is specified, then, Series is returned; otherwise, scalaris returned.

See also

Series.all

Return True if all elements are True.

DataFrame.any

Return True if one (or more) elements are True.

Examples

Series

>>>pd.Series([True,True]).all()True>>>pd.Series([True,False]).all()False>>>pd.Series([],dtype="float64").all()True>>>pd.Series([np.nan]).all()True>>>pd.Series([np.nan]).all(skipna=False)True

DataFrames

Create a dataframe from a dictionary.

>>>df=pd.DataFrame({'col1':[True,True],'col2':[True,False]})>>>df   col1   col20  True   True1  True  False

Default behaviour checks if values in each column all return True.

>>>df.all()col1     Truecol2    Falsedtype: bool

Specifyaxis='columns' to check if values in each row all return True.

>>>df.all(axis='columns')0     True1    Falsedtype: bool

Oraxis=None for whether every value is True.

>>>df.all(axis=None)False

[8]ページ先頭

©2009-2025 Movatter.jp