Skip to content

Commit 1c7fced

Browse files
committed
Revert "refactored skipna to switch"
This reverts commit 23bbe73.
1 parent 693e8b2 commit 1c7fced

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

pandas/core/nanops.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def _f(*args, **kwargs):
8787

8888
return _f
8989

90+
<<<<<<< HEAD
9091

9192
class skipna_switch(object):
9293

@@ -103,6 +104,8 @@ def f(values, axis=None, skipna=True, **kwds):
103104
return self.alt(values, axis, **kwds)
104105

105106
return f
107+
=======
108+
>>>>>>> parent of 23bbe7332... refactored skipna to switch
106109

107110

108111
class bottleneck_switch(object):
@@ -355,13 +358,15 @@ def nanmean(values, axis=None, skipna=True):
355358
return _wrap_results(the_mean, dtype)
356359

357360

358-
@skipna_switch(np.median)
359361
@disallow('M8')
360362
@bottleneck_switch()
361363
def nanmedian(values, axis=None, skipna=True):
362364

363365
values, mask, dtype, dtype_max = _get_values(values, skipna)
364366

367+
if not skipna:
368+
return _wrap_results(np.median(values, axis=axis), dtype)
369+
365370
def get_median(x):
366371
mask = notna(x)
367372
if not skipna and not mask.all():

pandas/tests/test_panel.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ def test_mean(self):
9191
def test_prod(self):
9292
self._check_stat_op('prod', np.prod)
9393

94+
9495
def test_median(self):
95-
def wrapper(x):
96+
def wrapper(x, **kwargs):
9697
if isna(x).any():
9798
return np.nan
9899
return np.median(x)
99-
100100
self._check_stat_op('median', wrapper)
101101

102+
102103
def test_min(self):
103104
self._check_stat_op('min', np.min)
104105

pandas/util/testing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@ def assert_categorical_equal(left, right, check_dtype=True,
10881088

10891089

10901090
def raise_assert_detail(obj, message, left, right, diff=None):
1091+
import pdb; pdb.set_trace()
10911092
if isinstance(left, np.ndarray):
10921093
left = pprint_thing(left)
10931094
if isinstance(right, np.ndarray):
@@ -1219,7 +1220,8 @@ def assert_series_equal(left, right, check_dtype=True,
12191220
Specify object name being compared, internally used to show appropriate
12201221
assertion message
12211222
"""
1222-
1223+
if np.isclose(left[0], 0.731904040441):
1224+
import pdb; pdb.set_trace()
12231225
# instance validation
12241226
_check_isinstance(left, right, Series)
12251227

0 commit comments

Comments
 (0)