@@ -288,15 +288,33 @@ def test_iloc_setitem_dups(self):
288
288
# iloc with a mask aligning from another iloc
289
289
df1 = DataFrame ([{'A' : None , 'B' : 1 }, {'A' : 2 , 'B' : 2 }])
290
290
df2 = DataFrame ([{'A' : 3 , 'B' : 3 }, {'A' : 4 , 'B' : 4 }])
291
- df = concat ([df1 , df2 ], axis = 1 )
291
+ df_orig = concat ([df1 , df2 ], axis = 1 )
292
+ df = df_orig .copy ()
292
293
294
+ # GH 15686
295
+ # iloc with mask, duplicated index and multiple blocks
293
296
expected = df .fillna (3 )
294
- expected [ 'A' ] = expected [ 'A' ].astype ('float64' )
297
+ expected . iloc [:, 0 ] = expected . iloc [:, 0 ].astype ('float64' )
295
298
inds = np .isnan (df .iloc [:, 0 ])
296
299
mask = inds [inds ].index
297
300
df .iloc [mask , 0 ] = df .iloc [mask , 2 ]
298
301
tm .assert_frame_equal (df , expected )
299
302
303
+ # GH 15686
304
+ # iloc with scalar, duplicated index and multiple blocks
305
+ df = df_orig .copy ()
306
+ expected = df .fillna (15 )
307
+ df .iloc [0 , 0 ] = 15
308
+ tm .assert_frame_equal (df , expected )
309
+
310
+ # GH 15686
311
+ # iloc with repeated value, duplicated index and multiple blocks
312
+ df = df_orig .copy ()
313
+ expected = concat ([DataFrame ([{'A' : 15 , 'B' : 1 }, {'A' : 15 , 'B' : 2 }]),
314
+ df2 ], axis = 1 )
315
+ df .iloc [:, 0 ] = 15
316
+ tm .assert_frame_equal (df , expected )
317
+
300
318
# del a dup column across blocks
301
319
expected = DataFrame ({0 : [1 , 2 ], 1 : [3 , 4 ]})
302
320
expected .columns = ['B' , 'B' ]
0 commit comments