@@ -187,36 +187,29 @@ Previous Behavior:
187187
188188.. code-block:: ipython
189189
190- In [6]: index = pd.Index ([-1, 0, 1])
190+ In [6]: index = pd.Int64Index ([-1, 0, 1])
191191
192192 In [7]: index / 0
193193 Out[7]: Int64Index([0, 0, 0], dtype='int64')
194194
195- In [8]: index = pd.UInt64Index([0, 1])
195+ # Previous behavior yielded different results depending on the type of zero in the divisor
196+ In [8]: index / 0.0
197+ Out[8]: Float64Index([-inf, nan, inf], dtype='float64')
196198
197- In [9]: index / np.array([0, 0], dtype=np.uint64)
198- Out[9]: UInt64Index([0, 0], dtype='uint64')
199+ In [9]: index = pd.UInt64Index([0, 1])
199200
200- In [10]: pd.RangeIndex(1, 5) / 0
201- ---------------------------------------------------------------------------
202- ZeroDivisionError Traceback (most recent call last)
203- <ipython-input-10-4c5e91d516f3> in <module>()
204- ----> 1 pd.RangeIndex(1, 5) / 0
205-
206- /usr/local/lib/python2.7/site-packages/pandas/core/indexes/range.pyc in _evaluate_numeric_binop(self, other)
207- 592 if step:
208- 593 with np.errstate(all='ignore'):
209- --> 594 rstep = step(self._step, other)
210- 595
211- 596 # we don't have a representable op
201+ In [10]: index / np.array([0, 0], dtype=np.uint64)
202+ Out[10]: UInt64Index([0, 0], dtype='uint64')
212203
204+ In [11]: pd.RangeIndex(1, 5) / 0
213205 ZeroDivisionError: integer division or modulo by zero
214206
215207Current Behavior:
216208
217209.. ipython:: python
218210
219- index = pd.Index([-1, 0, 1])
211+ index = pd.Int64Index([-1, 0, 1])
212+ # division by zero gives -infinity where negative, +infinity where positive, and NaN for 0 / 0
220213 index / 0
221214
222215 # The result of division by zero should not depend on whether the zero is int or float
0 commit comments