@@ -9894,11 +9894,11 @@ def _add_numeric_operations(cls):
98949894 axis_descr , name , name2 = _doc_parms (cls )
98959895
98969896 cls .any = _make_logical_function (
9897- cls , 'any' , name , name2 , axis_descr ,
9898- _any_desc , nanops . nanany , _any_examples , _any_see_also )
9897+ cls , 'any' , name , name2 , axis_descr , _any_desc , nanops . nanany ,
9898+ _any_examples , _any_see_also , empty_value = False )
98999899 cls .all = _make_logical_function (
9900- cls , 'all' , name , name2 , axis_descr , _all_doc ,
9901- nanops . nanall , _all_examples , _all_see_also )
9900+ cls , 'all' , name , name2 , axis_descr , _all_desc , nanops . nanall ,
9901+ _all_examples , _all_see_also , empty_value = True )
99029902
99039903 @Substitution (outname = 'mad' ,
99049904 desc = "Return the mean absolute deviation of the values "
@@ -10219,12 +10219,14 @@ def _doc_parms(cls):
1021910219 original index.
1022010220 * None : reduce all axes, return a scalar.
1022110221
10222- bool_only : boolean , default None
10222+ bool_only : bool , default None
1022310223 Include only boolean columns. If None, will attempt to use everything,
1022410224 then use only boolean data. Not implemented for Series.
10225- skipna : boolean, default True
10226- Exclude NA/null values. If an entire row/column is NA, the result
10227- will be NA.
10225+ skipna : bool, default True
10226+ Exclude NA/null values. If the entire row/column is NA and skipna is
10227+ True, then the result will be %(empty_value)s, as for an empty row/column.
10228+ If skipna is False, then NA are treated as True, because these are not
10229+ equal to zero.
1022810230level : int or level name, default None
1022910231 If the axis is a MultiIndex (hierarchical), count along a
1023010232 particular level, collapsing into a %(name1)s.
@@ -10234,28 +10236,37 @@ def _doc_parms(cls):
1023410236
1023510237Returns
1023610238-------
10237- %(outname)s : %(name1)s or %(name2)s (if level specified)
10239+ %(name1)s or %(name2)s
10240+ If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10241+ is returned.
1023810242
1023910243%(see_also)s
1024010244%(examples)s"""
1024110245
10242- _all_doc = """\
10246+ _all_desc = """\
1024310247 Return whether all elements are True, potentially over an axis.
1024410248
10245- Returns True if all elements within a series or along a Dataframe
10246- axis are non-zero, not-empty or not-False."""
10249+ Returns True unless there at least one element within a series or
10250+ along a Dataframe axis that is False or equivalent (e.g. zero or
10251+ empty)."""
1024710252
1024810253_all_examples = """\
1024910254 Examples
1025010255--------
10251- Series
10256+ ** Series**
1025210257
1025310258>>> pd.Series([True, True]).all()
1025410259True
1025510260>>> pd.Series([True, False]).all()
1025610261False
10262+ >>> pd.Series([]).all()
10263+ True
10264+ >>> pd.Series([np.nan]).all()
10265+ True
10266+ >>> pd.Series([np.nan]).all(skipna=False)
10267+ True
1025710268
10258- DataFrames
10269+ ** DataFrames**
1025910270
1026010271Create a dataframe from a dictionary.
1026110272
@@ -10597,10 +10608,11 @@ def _doc_parms(cls):
1059710608"""
1059810609
1059910610_any_desc = """\
10600- Return whether any element is True over requested axis.
10611+ Return whether any element is True, potentially over an axis.
1060110612
10602- Unlike :meth:`DataFrame.all`, this performs an *or* operation. If any of the
10603- values along the specified axis is True, this will return True."""
10613+ Returns False unless there at least one element within a series or
10614+ along a Dataframe axis that is True or equivalent (e.g. non-zero or
10615+ non-empty)."""
1060410616
1060510617_any_examples = """\
1060610618 Examples
@@ -10610,8 +10622,16 @@ def _doc_parms(cls):
1061010622For Series input, the output is a scalar indicating whether any element
1061110623is True.
1061210624
10625+ >>> pd.Series([False, False]).any()
10626+ False
1061310627>>> pd.Series([True, False]).any()
1061410628True
10629+ >>> pd.Series([]).any()
10630+ False
10631+ >>> pd.Series([np.nan]).any()
10632+ False
10633+ >>> pd.Series([np.nan]).any(skipna=False)
10634+ True
1061510635
1061610636**DataFrame**
1061710637
@@ -10897,9 +10917,10 @@ def cum_func(self, axis=None, skipna=True, *args, **kwargs):
1089710917
1089810918
1089910919def _make_logical_function (cls , name , name1 , name2 , axis_descr , desc , f ,
10900- examples , see_also ):
10920+ examples , see_also , empty_value ):
1090110921 @Substitution (outname = name , desc = desc , name1 = name1 , name2 = name2 ,
10902- axis_descr = axis_descr , examples = examples , see_also = see_also )
10922+ axis_descr = axis_descr , examples = examples , see_also = see_also ,
10923+ empty_value = empty_value )
1090310924 @Appender (_bool_doc )
1090410925 def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None ,
1090510926 ** kwargs ):
0 commit comments