Skip to content

Removed skipna argument from count, any, all [GH755] #4258

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 3 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Bug fixes

Documentation
~~~~~~~~~~~~~

- removed skipna argument from :py:meth:`DataArray.count`, any, all. (:issue:`755`)
By `Sander van Rijn <https://github.com/sjvrijn>`_

Internal Changes
~~~~~~~~~~~~~~~~
Expand Down
16 changes: 10 additions & 6 deletions xarray/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@

Parameters
----------
{extra_args}
skipna : bool, optional
If True, skip missing values (as marked by NaN). By default, only
skips missing values for float dtypes; other dtypes either do not
have a sentinel missing value (int) or skipna=True has not been
implemented (object, datetime64 or timedelta64).{min_count_docs}
{extra_args}{skip_na_docs}{min_count_docs}
keep_attrs : bool, optional
If True, the attributes (`attrs`) will be copied from the original
object to the new one. If False (default), the new object will be
Expand All @@ -111,6 +106,13 @@
indicated dimension(s) removed.
"""

_SKIPNA_DOCSTRING = """
skipna : bool, optional
If True, skip missing values (as marked by NaN). By default, only
skips missing values for float dtypes; other dtypes either do not
have a sentinel missing value (int) or skipna=True has not been
implemented (object, datetime64 or timedelta64)."""

_MINCOUNT_DOCSTRING = """
min_count : int, default None
The required number of valid values to perform the operation.
Expand Down Expand Up @@ -260,6 +262,7 @@ def inject_reduce_methods(cls):
for name, f, include_skipna in methods:
numeric_only = getattr(f, "numeric_only", False)
available_min_count = getattr(f, "available_min_count", False)
skip_na_docs = _SKIPNA_DOCSTRING if include_skipna else ""
min_count_docs = _MINCOUNT_DOCSTRING if available_min_count else ""

func = cls._reduce_method(f, include_skipna, numeric_only)
Expand All @@ -268,6 +271,7 @@ def inject_reduce_methods(cls):
name=name,
cls=cls.__name__,
extra_args=cls._reduce_extra_args_docstring.format(name=name),
skip_na_docs=skip_na_docs,
min_count_docs=min_count_docs,
)
setattr(cls, name, func)
Expand Down