@@ -7583,8 +7583,7 @@ def _add_numeric_operations(cls):
7583
7583
7584
7584
cls .any = _make_logical_function (
7585
7585
cls , 'any' , name , name2 , axis_descr ,
7586
- 'Return whether any element is True over requested axis' ,
7587
- nanops .nanany , '' , '' )
7586
+ _any_desc , nanops .nanany , _any_examples , _any_see_also )
7588
7587
cls .all = _make_logical_function (
7589
7588
cls , 'all' , name , name2 , axis_descr , _all_doc ,
7590
7589
nanops .nanall , _all_examples , _all_see_also )
@@ -7848,7 +7847,8 @@ def _doc_parms(cls):
7848
7847
7849
7848
Parameters
7850
7849
----------
7851
- axis : %(axis_descr)s
7850
+ axis : int, default 0
7851
+ Select the axis which can be 0 for indices and 1 for columns.
7852
7852
skipna : boolean, default True
7853
7853
Exclude NA/null values. If an entire row/column is NA, the result
7854
7854
will be NA.
@@ -7866,8 +7866,8 @@ def _doc_parms(cls):
7866
7866
-------
7867
7867
%(outname)s : %(name1)s or %(name2)s (if level specified)
7868
7868
7869
- %(examples )s
7870
- %(see_also )s"""
7869
+ %(see_also )s
7870
+ %(examples )s"""
7871
7871
7872
7872
_all_doc = """\
7873
7873
Return whether all elements are True over series or dataframe axis.
@@ -7938,6 +7938,74 @@ def _doc_parms(cls):
7938
7938
7939
7939
"""
7940
7940
7941
+ _any_see_also = """\
7942
+ See Also
7943
+ --------
7944
+ pandas.DataFrame.all : Return whether all elements are True.
7945
+ """
7946
+
7947
+ _any_desc = """\
7948
+ Return whether any element is True over requested axis.
7949
+
7950
+ Unlike :meth:`DataFrame.all`, this performs an *or* operation. If any of the
7951
+ values along the specified axis is True, this will return True."""
7952
+
7953
+ _any_examples = """\
7954
+ Examples
7955
+ --------
7956
+ **Series**
7957
+
7958
+ For Series input, the output is a scalar indicating whether any element
7959
+ is True.
7960
+
7961
+ >>> pd.Series([True, False]).any()
7962
+ True
7963
+
7964
+ **DataFrame**
7965
+
7966
+ Whether each column contains at least one True element (the default).
7967
+
7968
+ >>> df = pd.DataFrame({"A": [1, 2], "B": [0, 2], "C": [0, 0]})
7969
+ >>> df
7970
+ A B C
7971
+ 0 1 0 0
7972
+ 1 2 2 0
7973
+
7974
+ >>> df.any()
7975
+ A True
7976
+ B True
7977
+ C False
7978
+ dtype: bool
7979
+
7980
+ Aggregating over the columns.
7981
+
7982
+ >>> df = pd.DataFrame({"A": [True, False], "B": [1, 2]})
7983
+ >>> df
7984
+ A B
7985
+ 0 True 1
7986
+ 1 False 2
7987
+
7988
+ >>> df.any(axis='columns')
7989
+ 0 True
7990
+ 1 True
7991
+ dtype: bool
7992
+
7993
+ >>> df = pd.DataFrame({"A": [True, False], "B": [1, 0]})
7994
+ >>> df
7995
+ A B
7996
+ 0 True 1
7997
+ 1 False 0
7998
+
7999
+ >>> df.any(axis='columns')
8000
+ 0 True
8001
+ 1 False
8002
+ dtype: bool
8003
+
8004
+ `any` for an empty DataFrame is an empty Series.
8005
+
8006
+ >>> pd.DataFrame([]).any()
8007
+ Series([], dtype: bool)
8008
+ """
7941
8009
7942
8010
_sum_examples = """\
7943
8011
Examples
0 commit comments