|
3 | 3 |
|
4 | 4 | from functools import partial
|
5 | 5 |
|
| 6 | +import warnings |
6 | 7 | import numpy as np
|
7 | 8 | from pandas import Series
|
8 | 9 | from pandas.core.common import isnull, is_integer_dtype
|
@@ -135,7 +136,7 @@ def _coerce_tds(targ, res):
|
135 | 136 | return targ, res
|
136 | 137 |
|
137 | 138 | try:
|
138 |
| - if axis != 0 and hasattr(targ, 'shape') and targ.ndim: |
| 139 | + if axis != 0 and hasattr(targ, 'shape') and targ.ndim and targ.shape != res.shape: |
139 | 140 | res = np.split(res, [targ.shape[0]], axis=0)[0]
|
140 | 141 | except:
|
141 | 142 | targ, res = _coerce_tds(targ, res)
|
@@ -364,10 +365,11 @@ def test_returned_dtype(self):
|
364 | 365 | "return dtype expected from %s is %s, got %s instead" % (method, dtype, result.dtype))
|
365 | 366 |
|
366 | 367 | def test_nanmedian(self):
|
367 |
| - self.check_funs(nanops.nanmedian, np.median, |
368 |
| - allow_complex=False, allow_str=False, allow_date=False, |
369 |
| - allow_tdelta=True, |
370 |
| - allow_obj='convert') |
| 368 | + with warnings.catch_warnings(record=True): |
| 369 | + self.check_funs(nanops.nanmedian, np.median, |
| 370 | + allow_complex=False, allow_str=False, allow_date=False, |
| 371 | + allow_tdelta=True, |
| 372 | + allow_obj='convert') |
371 | 373 |
|
372 | 374 | def test_nanvar(self):
|
373 | 375 | self.check_funs_ddof(nanops.nanvar, np.var,
|
|
0 commit comments