@@ -187,23 +187,46 @@ Previous Behavior:
187
187
188
188
.. code-block:: ipython
189
189
190
- index = pd.Index([-1, 0, 1])
191
- index / 0
190
+ In [6]: index = pd.Index([-1, 0, 1])
192
191
193
- index = pd.UInt64Index([0, 1])
194
- index / np.array([0, 0], dtype=np.uint64)
192
+ In [7]: index / 0
193
+ Out[7]: Int64Index([0, 0, 0], dtype='int64')
194
+
195
+ In [8]: index = pd.UInt64Index([0, 1])
196
+
197
+ In [9]: index / np.array([0, 0], dtype=np.uint64)
198
+ Out[9]: UInt64Index([0, 0], dtype='uint64')
199
+
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
212
+
213
+ ZeroDivisionError: integer division or modulo by zero
195
214
196
215
Current Behavior:
197
216
198
217
.. ipython:: python
199
218
200
219
index = pd.Index([-1, 0, 1])
201
220
index / 0
221
+
222
+ # The result of division by zero should not depend on whether the zero is int or float
202
223
index / 0.0
203
224
204
225
index = pd.UInt64Index([0, 1])
205
226
index / np.array([0, 0], dtype=np.uint64)
206
227
228
+ pd.RangeIndex(1, 5) / 0
229
+
207
230
.. _whatsnew_0230.enhancements.other:
208
231
209
232
Other Enhancements
0 commit comments