@@ -150,6 +150,36 @@ def test_usecase():
150
150
dtype = object ,
151
151
).set_index ("my_index" ),
152
152
),
153
+ (
154
+ pd .DataFrame (
155
+ {
156
+ "col" : [[1 , 2 ], [3 , 4 ]],
157
+ "other_col" : ["a" , "b" ],
158
+ "my_first_index" : [0 , 0 ],
159
+ "my_second_index" : [1 , 1 ],
160
+ }
161
+ ).set_index (["my_first_index" , "my_second_index" ]),
162
+ pd .DataFrame (
163
+ {
164
+ "col" : [1 , 2 , 3 , 4 ],
165
+ "other_col" : ["a" , "a" , "b" , "b" ],
166
+ "my_first_index" : [0 , 0 , 0 , 0 ],
167
+ "my_second_index" : [1 , 1 , 1 , 1 ],
168
+ },
169
+ dtype = object ,
170
+ ).set_index (["my_first_index" , "my_second_index" ]),
171
+ ),
172
+ (
173
+ pd .DataFrame (
174
+ {"col" : [[1 , 2 ], [3 , 4 ]], "other_col" : ["a" , "b" ]},
175
+ pd .MultiIndex .from_tuples ([(0 , 1 ), (0 , 1 )]),
176
+ ),
177
+ pd .DataFrame (
178
+ {"col" : [1 , 2 , 3 , 4 ], "other_col" : ["a" , "a" , "b" , "b" ]},
179
+ index = pd .MultiIndex .from_tuples ([(0 , 1 ), (0 , 1 ), (0 , 1 ), (0 , 1 )]),
180
+ dtype = object ,
181
+ ),
182
+ ),
153
183
],
154
184
)
155
185
def test_duplicate_index (df , expected ):
0 commit comments