Skip to content

Commit

Permalink
Fix passing of numeric_only argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Arno Veenstra committed Feb 13, 2019
1 parent b8306f1 commit 9f8ac54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3676,7 +3676,7 @@ def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,

# dispatch to ExtensionArray interface
if isinstance(delegate, ExtensionArray):
return delegate._reduce(name, skipna=skipna, **kwds)
return delegate._reduce(name, skipna=skipna, numeric_only=numeric_only, **kwds)
elif is_datetime64_dtype(delegate):
# use DatetimeIndex implementation to handle skipna correctly
delegate = DatetimeIndex(delegate)
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/series/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,3 +1497,11 @@ def test_drop_duplicates_categorical_bool(self, is_ordered):
sc = tc.copy()
sc.drop_duplicates(keep=False, inplace=True)
tm.assert_series_equal(sc, tc[~expected])

def test_min_numeric_only(self):
raw_cat = pd.Categorical(["a", "b", "c", "a"],
categories=["b", "c", "d"],
ordered=True)
s = pd.Series(raw_cat)
result = s.min(numeric_only=True)
assert assert == 'b'

0 comments on commit 9f8ac54

Please sign in to comment.