diff --git a/doc/source/v0.15.0.txt b/doc/source/v0.15.0.txt index eb58f46f0f3fe..ca24eb3f910ed 100644 --- a/doc/source/v0.15.0.txt +++ b/doc/source/v0.15.0.txt @@ -184,7 +184,7 @@ There are no experimental changes in 0.15.0 Bug Fixes ~~~~~~~~~ - +- Bug in Series 0-division with a float and integer operand dtypes (:issue:`7785`) - Bug in ``Series.astype("unicode")`` not calling ``unicode`` on the values correctly (:issue:`7758`) - Bug in ``DataFrame.as_matrix()`` with mixed ``datetime64[ns]`` and ``timedelta64[ns]`` dtypes (:issue:`7778`) diff --git a/pandas/core/common.py b/pandas/core/common.py index 1a57c9c33ba7c..04c5140d6a59b 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -1328,7 +1328,7 @@ def _fill_zeros(result, x, y, name, fill): # correctly # GH 6178 if np.isinf(fill): - np.putmask(result,signs<0 & mask, -fill) + np.putmask(result,(signs<0) & mask, -fill) result = result.reshape(shape) diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py index fda0abe07050d..e56da6c6522a5 100644 --- a/pandas/tests/test_series.py +++ b/pandas/tests/test_series.py @@ -2362,6 +2362,17 @@ def test_div(self): expected = Series([np.nan,np.inf,-np.inf]) assert_series_equal(result, expected) + # float/integer issue + # GH 7785 + p = DataFrame({'first': (1,0), 'second': (-0.01,-0.02)}) + expected = Series([-0.01,-np.inf]) + + result = p['second'].div(p['first']) + assert_series_equal(result, expected) + + result = p['second'] / p['first'] + assert_series_equal(result, expected) + def test_operators(self): def _check_op(series, other, op, pos_only=False): @@ -4865,12 +4876,12 @@ def test_astype_unicode(self): test_series = [ Series([digits * 10, tm.rands(63), tm.rands(64), tm.rands(1000)]), Series([u"データーサイエンス、お前はもう死んでいる"]), - + ] - + former_encoding = None if not compat.PY3: - # in python we can force the default encoding + # in python we can force the default encoding # for this test former_encoding = sys.getdefaultencoding() reload(sys)