Skip to content

Commit

Permalink
Whatsnew section
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Jan 24, 2018
1 parent cd54349 commit ca3bf42
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,37 @@ Please note that the string `index` is not supported with the round trip format,
new_df
print(new_df.index.name)

.. _whatsnew_0230.enhancements.index_division_by_zero

Index Division By Zero Fills Correctly
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Division operations on ``Index`` and subclasses will now fill positive / 0 with ``np.inf``, negative / 0 with ``-np.inf``, and 0 / 0 with ``np.nan``. This matches existing Series behavior.

Current Behavior:

.. code-block:: ipython

In [3]: index = pd.Index([-1, 0, 1])
In [4]: index / 0
Out[4]: Int64Index([0, 0, 0], dtype='int64')
In [5]: index / 0.0
Out[5]: Float64Index([-inf, nan, inf], dtype='float64')

In [6]: index = pd.UInt64Index([0, 1])
In [7]: index / np.array([0, 0], dtype=np.uint64)
Out[7]: UInt64Index([0, 0], dtype='uint64')

Previous Behavior:

.. code-block:: ipython

index = pd.Index([-1, 0, 1])
index / 0

index = pd.UInt64Index([0, 1])
index / np.array([0, 0], dtype=np.uint64)

.. _whatsnew_0230.enhancements.other:

Other Enhancements
Expand Down

0 comments on commit ca3bf42

Please sign in to comment.