@@ -1367,7 +1367,9 @@ def _iset_single(
13671367 self ._clear_reference_block (blkno )
13681368 return
13691369
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 :
13711373 """
13721374 Set values ("setitem") into a single column (not setting the full column).
13731375
@@ -1385,8 +1387,11 @@ def column_setitem(self, loc: int, idx: int | slice | np.ndarray, value) -> None
13851387 # this manager is only created temporarily to mutate the values in place
13861388 # so don't track references, otherwise the `setitem` would perform CoW again
13871389 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 )
13901395
13911396 def insert (self , loc : int , item : Hashable , value : ArrayLike ) -> None :
13921397 """
0 commit comments