Skip to content

Commit 933615b

Browse files
author
Jiang Yue
committed
move multiIndex bug to api breaking changes
1 parent 041b4cd commit 933615b

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

doc/source/whatsnew/v0.25.0.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,40 @@ is respected in indexing. (:issue:`24076`, :issue:`16785`)
7777
7878
df['2019-01-01 12:00:00+04:00':'2019-01-01 13:00:00+04:00']
7979
80+
81+
.. _whatsnew_0250.api_breaking.multi_indexing:
82+
83+
84+
MultiIndexing contracted from levels and codes
85+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
87+
Constructing a :class:`MultiIndex` with NaN levels or codes value < -1 was allowed previously.
88+
Now, construction with codes value < -1 is not allowed and NaN levels' corresponding codes
89+
would be reassigned as -1. (:issue:`19387`)
90+
91+
.. ipython:: python
92+
93+
pd.MultiIndex(levels=[[np.nan, None, pd.NaT, 128, 2]], codes=[[0, -1, 1, 2, 3, 4]])
94+
pd.MultiIndex(levels=[[1, 2]], codes=[[0, -2]])
95+
96+
*Previous Behavior*:
97+
98+
.. code-block:: ipython
99+
100+
MultiIndex(levels=[[nan, None, NaT, 128, 2]],
101+
codes=[[0, -1, 1, 2, 3, 4]])
102+
MultiIndex(levels=[[1, 2]],
103+
codes=[[0, -2]])
104+
105+
*New Behavior*:
106+
107+
.. ipython:: python
108+
109+
MultiIndex(levels=[[nan, None, NaT, 128, 2]],
110+
codes=[[-1, -1, -1, -1, 3, 4]])
111+
ValueError: On level 0, code value (-2) < -1
112+
113+
80114
.. _whatsnew_0250.api_breaking.groupby_apply_first_group_once:
81115

82116
GroupBy.apply on ``DataFrame`` evaluates first group only once
@@ -387,7 +421,7 @@ MultiIndex
387421
^^^^^^^^^^
388422

389423
- Bug in which incorrect exception raised by :class:`Timedelta` when testing the membership of :class:`MultiIndex` (:issue:`24570`)
390-
- Bug in :class:`Multindex` construction from levels and codes that would incorrectly allows code values < -1 or NaN levels (:issue:`19387`)
424+
-
391425

392426
I/O
393427
^^^

0 commit comments

Comments
 (0)