From f27d0d051c8fc74228bdb3f71ac74258cd2b7183 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Thu, 23 Jul 2020 15:33:23 +0200 Subject: [PATCH 1/2] Docs: extracted skipna argument docstring for reduce [GH755] --- xarray/core/ops.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/xarray/core/ops.py b/xarray/core/ops.py index d4aeea37aad..3675317977f 100644 --- a/xarray/core/ops.py +++ b/xarray/core/ops.py @@ -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 @@ -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. @@ -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) @@ -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) From 625610e154259e211a4640b3c40a23d3438cad50 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Thu, 23 Jul 2020 15:55:34 +0200 Subject: [PATCH 2/2] Added summary to whats-new.rst --- doc/whats-new.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index d086d4f411d..87497939904 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -33,7 +33,8 @@ Bug fixes Documentation ~~~~~~~~~~~~~ - +- removed skipna argument from :py:meth:`DataArray.count`, any, all. (:issue:`755`) + By `Sander van Rijn `_ Internal Changes ~~~~~~~~~~~~~~~~