@@ -1335,7 +1335,9 @@ def _iset_single(
1335
1335
self ._clear_reference_block (blkno )
1336
1336
return
1337
1337
1338
- def column_setitem (self , loc : int , idx : int | slice | np .ndarray , value ) -> None :
1338
+ def column_setitem (
1339
+ self , loc : int , idx : int | slice | np .ndarray , value , inplace : bool = False
1340
+ ) -> None :
1339
1341
"""
1340
1342
Set values ("setitem") into a single column (not setting the full column).
1341
1343
@@ -1353,8 +1355,11 @@ def column_setitem(self, loc: int, idx: int | slice | np.ndarray, value) -> None
1353
1355
# this manager is only created temporarily to mutate the values in place
1354
1356
# so don't track references, otherwise the `setitem` would perform CoW again
1355
1357
col_mgr = self .iget (loc , track_ref = False )
1356
- new_mgr = col_mgr .setitem ((idx ,), value )
1357
- self .iset (loc , new_mgr ._block .values , inplace = True )
1358
+ if inplace :
1359
+ col_mgr .setitem_inplace (idx , value )
1360
+ else :
1361
+ new_mgr = col_mgr .setitem ((idx ,), value )
1362
+ self .iset (loc , new_mgr ._block .values , inplace = True )
1358
1363
1359
1364
def insert (self , loc : int , item : Hashable , value : ArrayLike ) -> None :
1360
1365
"""
0 commit comments