Skip to content

Commit 6c1203a

Browse files
authored
Removed skipna argument from count, any, all [GH755] (#4258)
* Docs: extracted skipna argument docstring for reduce [GH755] * Added summary to whats-new.rst
1 parent 349c596 commit 6c1203a

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

doc/whats-new.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Bug fixes
3737

3838
Documentation
3939
~~~~~~~~~~~~~
40-
40+
- removed skipna argument from :py:meth:`DataArray.count`, any, all. (:issue:`755`)
41+
By `Sander van Rijn <https://github.com/sjvrijn>`_
4142

4243
Internal Changes
4344
~~~~~~~~~~~~~~~~

xarray/core/ops.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@
9090
9191
Parameters
9292
----------
93-
{extra_args}
94-
skipna : bool, optional
95-
If True, skip missing values (as marked by NaN). By default, only
96-
skips missing values for float dtypes; other dtypes either do not
97-
have a sentinel missing value (int) or skipna=True has not been
98-
implemented (object, datetime64 or timedelta64).{min_count_docs}
93+
{extra_args}{skip_na_docs}{min_count_docs}
9994
keep_attrs : bool, optional
10095
If True, the attributes (`attrs`) will be copied from the original
10196
object to the new one. If False (default), the new object will be
@@ -111,6 +106,13 @@
111106
indicated dimension(s) removed.
112107
"""
113108

109+
_SKIPNA_DOCSTRING = """
110+
skipna : bool, optional
111+
If True, skip missing values (as marked by NaN). By default, only
112+
skips missing values for float dtypes; other dtypes either do not
113+
have a sentinel missing value (int) or skipna=True has not been
114+
implemented (object, datetime64 or timedelta64)."""
115+
114116
_MINCOUNT_DOCSTRING = """
115117
min_count : int, default None
116118
The required number of valid values to perform the operation.
@@ -260,6 +262,7 @@ def inject_reduce_methods(cls):
260262
for name, f, include_skipna in methods:
261263
numeric_only = getattr(f, "numeric_only", False)
262264
available_min_count = getattr(f, "available_min_count", False)
265+
skip_na_docs = _SKIPNA_DOCSTRING if include_skipna else ""
263266
min_count_docs = _MINCOUNT_DOCSTRING if available_min_count else ""
264267

265268
func = cls._reduce_method(f, include_skipna, numeric_only)
@@ -268,6 +271,7 @@ def inject_reduce_methods(cls):
268271
name=name,
269272
cls=cls.__name__,
270273
extra_args=cls._reduce_extra_args_docstring.format(name=name),
274+
skip_na_docs=skip_na_docs,
271275
min_count_docs=min_count_docs,
272276
)
273277
setattr(cls, name, func)

0 commit comments

Comments
 (0)