Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/source/v0.14.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ Bug Fixes
- Bug where bool objects were converted to ``nan`` in ``convert_objects``
(:issue:`7416`).
- Bug in ``quantile`` ignoring the axis keyword argument (:issue`7306`)

- Bug where ``nanops._maybe_null_out`` doesn't work with complex numbers
(:issue:`7353`)



Expand Down
5 changes: 4 additions & 1 deletion pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,10 @@ def _maybe_null_out(result, axis, mask):
if axis is not None:
null_mask = (mask.shape[axis] - mask.sum(axis)) == 0
if null_mask.any():
result = result.astype('f8')
if np.iscomplexobj(result):
result = result.astype('c16')
else:
result = result.astype('f8')
result[null_mask] = np.nan
else:
null_mask = mask.size - mask.sum()
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/test_nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def test_nanall(self):

def test_nansum(self):
self.check_funs(nanops.nansum, np.sum,
allow_complex=False,
allow_str=False, allow_date=False)

def _nanmean_wrap(self, value, *args, **kwargs):
Expand Down Expand Up @@ -291,13 +290,11 @@ def _minmax_wrap(self, value, axis=None, func=None):
def test_nanmin(self):
func = partial(self._minmax_wrap, func=np.min)
self.check_funs(nanops.nanmin, func,
allow_complex=False,
allow_str=False, allow_obj=False)

def test_nanmax(self):
func = partial(self._minmax_wrap, func=np.max)
self.check_funs(nanops.nanmax, func,
allow_complex=False,
allow_str=False, allow_obj=False)

def _argminmax_wrap(self, value, axis=None, func=None):
Expand Down Expand Up @@ -355,7 +352,6 @@ def test_nankurt(self):

def test_nanprod(self):
self.check_funs(nanops.nanprod, np.prod,
allow_complex=False,
allow_str=False, allow_date=False)

def check_nancorr_nancov_2d(self, checkfun, targ0, targ1, **kwargs):
Expand Down