@@ -77,6 +77,40 @@ is respected in indexing. (:issue:`24076`, :issue:`16785`)
77
77
78
78
df[' 2019-01-01 12:00:00+04:00' :' 2019-01-01 13:00:00+04:00' ]
79
79
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
+
80
114
.. _whatsnew_0250.api_breaking.groupby_apply_first_group_once :
81
115
82
116
GroupBy.apply on ``DataFrame `` evaluates first group only once
@@ -387,7 +421,7 @@ MultiIndex
387
421
^^^^^^^^^^
388
422
389
423
- 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
+ -
391
425
392
426
I/O
393
427
^^^
0 commit comments