Skip to content

Fix deprecation warnings for empty series in docstrings #41463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11359,7 +11359,7 @@ def _doc_params(cls):
True
>>> pd.Series([True, False]).all()
False
>>> pd.Series([]).all()
>>> pd.Series([], dtype="float64").all()
True
>>> pd.Series([np.nan]).all()
True
Expand Down Expand Up @@ -11727,7 +11727,7 @@ def _doc_params(cls):
False
>>> pd.Series([True, False]).any()
True
>>> pd.Series([]).any()
>>> pd.Series([], dtype="float64").any()
False
>>> pd.Series([np.nan]).any()
False
Expand Down Expand Up @@ -11815,13 +11815,13 @@ def _doc_params(cls):

By default, the sum of an empty or all-NA Series is ``0``.

>>> pd.Series([]).sum() # min_count=0 is the default
>>> pd.Series([], dtype="float64").sum() # min_count=0 is the default
0.0

This can be controlled with the ``min_count`` parameter. For example, if
you'd like the sum of an empty series to be NaN, pass ``min_count=1``.

>>> pd.Series([]).sum(min_count=1)
>>> pd.Series([], dtype="float64").sum(min_count=1)
nan

Thanks to the ``skipna`` parameter, ``min_count`` handles all-NA and
Expand Down Expand Up @@ -11862,12 +11862,12 @@ def _doc_params(cls):
--------
By default, the product of an empty or all-NA Series is ``1``

>>> pd.Series([]).prod()
>>> pd.Series([], dtype="float64").prod()
1.0

This can be controlled with the ``min_count`` parameter

>>> pd.Series([]).prod(min_count=1)
>>> pd.Series([], dtype="float64").prod(min_count=1)
nan

Thanks to the ``skipna`` parameter, ``min_count`` handles all-NA and
Expand Down