@@ -1367,7 +1367,9 @@ def _iset_single(
1367
1367
self ._clear_reference_block (blkno )
1368
1368
return
1369
1369
1370
- def column_setitem (self , loc : int , idx : int | slice | np .ndarray , value ) -> None :
1370
+ def column_setitem (
1371
+ self , loc : int , idx : int | slice | np .ndarray , value , inplace : bool = False
1372
+ ) -> None :
1371
1373
"""
1372
1374
Set values ("setitem") into a single column (not setting the full column).
1373
1375
@@ -1385,8 +1387,11 @@ def column_setitem(self, loc: int, idx: int | slice | np.ndarray, value) -> None
1385
1387
# this manager is only created temporarily to mutate the values in place
1386
1388
# so don't track references, otherwise the `setitem` would perform CoW again
1387
1389
col_mgr = self .iget (loc , track_ref = False )
1388
- new_mgr = col_mgr .setitem ((idx ,), value )
1389
- self .iset (loc , new_mgr ._block .values , inplace = True )
1390
+ if inplace :
1391
+ col_mgr .setitem_inplace (idx , value )
1392
+ else :
1393
+ new_mgr = col_mgr .setitem ((idx ,), value )
1394
+ self .iset (loc , new_mgr ._block .values , inplace = True )
1390
1395
1391
1396
def insert (self , loc : int , item : Hashable , value : ArrayLike ) -> None :
1392
1397
"""
0 commit comments