From 2bf6bb2ede50f6ffd23cd6a8544c6d5af433ad17 Mon Sep 17 00:00:00 2001 From: Ashwin Prakash Nalwade <53330017+ashwinpn@users.noreply.github.com> Date: Thu, 5 Mar 2020 20:48:36 -0500 Subject: [PATCH 1/3] Update strings.py --- pandas/core/strings.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 3be9c5fcdfb26..71d33e807d477 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -570,9 +570,8 @@ def str_endswith(arr, pat, na=np.nan): def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=True): r""" - Replace occurrences of pattern/regex in the Series/Index with - some other string. Equivalent to :meth:`str.replace` or - :func:`re.sub`. + Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to :meth:`str.replace` or + :func:`re.sub`, depending on the regex value. Parameters ---------- From 2e5852d02a8b61f30b15a99743235f0b25b34307 Mon Sep 17 00:00:00 2001 From: Ashwin Prakash Nalwade <53330017+ashwinpn@users.noreply.github.com> Date: Thu, 5 Mar 2020 21:06:56 -0500 Subject: [PATCH 2/3] Update strings.py --- pandas/core/strings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 71d33e807d477..c4bdbaff1649c 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -570,7 +570,8 @@ def str_endswith(arr, pat, na=np.nan): def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=True): r""" - Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to :meth:`str.replace` or + Replace occurrences of pattern/regex in the Series/Index with + some other string. Equivalent to :meth:`str.replace` or :func:`re.sub`, depending on the regex value. Parameters From 544fb3e9284f85753e7bb2388904dd85866291e5 Mon Sep 17 00:00:00 2001 From: Ashwin P N <53330017+ashwinpn@users.noreply.github.com> Date: Sat, 16 May 2020 10:25:46 -0400 Subject: [PATCH 3/3] Eliminated the skipna / dropna inconsistency. --- pandas/core/frame.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 31015e3095e7d..fc28f8001ac77 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8367,7 +8367,7 @@ def _count_level(self, level, axis=0, numeric_only=False): return result def _reduce( - self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds + self, op, name, axis=0, dropna=True, numeric_only=None, filter_type=None, **kwds ): assert filter_type is None or filter_type == "bool", filter_type @@ -8400,7 +8400,7 @@ def _reduce( constructor = self._constructor def f(x): - return op(x, axis=axis, skipna=skipna, **kwds) + return op(x, axis=axis, dropna=dropna, **kwds) def _get_data(axis_matters): if filter_type is None: @@ -8431,9 +8431,9 @@ def _get_data(axis_matters): def blk_func(values): if isinstance(values, ExtensionArray): - return values._reduce(name, skipna=skipna, **kwds) + return values._reduce(name, dropna=dropna, **kwds) else: - return op(values, axis=1, skipna=skipna, **kwds) + return op(values, axis=1, dropna=dropna, **kwds) # After possibly _get_data and transposing, we are now in the # simple case where we can use BlockManager._reduce @@ -8562,7 +8562,7 @@ def nunique(self, axis=0, dropna=True) -> Series: """ return self.apply(Series.nunique, axis=axis, dropna=dropna) - def idxmin(self, axis=0, skipna=True) -> Series: + def idxmin(self, axis=0, dropna=True) -> Series: """ Return index of first occurrence of minimum over requested axis. @@ -8572,7 +8572,7 @@ def idxmin(self, axis=0, skipna=True) -> Series: ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise. - skipna : bool, default True + dropna : bool, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. @@ -8624,7 +8624,7 @@ def idxmin(self, axis=0, skipna=True) -> Series: dtype: object """ axis = self._get_axis_number(axis) - indices = nanops.nanargmin(self.values, axis=axis, skipna=skipna) + indices = nanops.nanargmin(self.values, axis=axis, dropna=dropna) # indices will always be np.ndarray since axis is not None and # values is a 2d array for DataFrame @@ -8635,7 +8635,7 @@ def idxmin(self, axis=0, skipna=True) -> Series: result = [index[i] if i >= 0 else np.nan for i in indices] return self._constructor_sliced(result, index=self._get_agg_axis(axis)) - def idxmax(self, axis=0, skipna=True) -> Series: + def idxmax(self, axis=0, dropna=True) -> Series: """ Return index of first occurrence of maximum over requested axis. @@ -8645,7 +8645,7 @@ def idxmax(self, axis=0, skipna=True) -> Series: ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise. - skipna : bool, default True + dropna : bool, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. @@ -8697,7 +8697,7 @@ def idxmax(self, axis=0, skipna=True) -> Series: dtype: object """ axis = self._get_axis_number(axis) - indices = nanops.nanargmax(self.values, axis=axis, skipna=skipna) + indices = nanops.nanargmax(self.values, axis=axis, dropna=dropna) # indices will always be np.ndarray since axis is not None and # values is a 2d array for DataFrame