@@ -1032,9 +1032,7 @@ def _putmask_simple(self, mask: np.ndarray, value: Any):
10321032 # GH#37833 np.putmask is more performant than __setitem__ 
10331033 np .putmask (values , mask , value )
10341034
1035-  def  putmask (
1036-  self , mask , new , inplace : bool  =  False , axis : int  =  0 , transpose : bool  =  False 
1037-  ) ->  List ["Block" ]:
1035+  def  putmask (self , mask , new , axis : int  =  0 ) ->  List ["Block" ]:
10381036 """ 
10391037 putmask the data to the block; it is possible that we may create a 
10401038 new dtype of block 
@@ -1045,16 +1043,13 @@ def putmask(
10451043 ---------- 
10461044 mask : np.ndarray[bool], SparseArray[bool], or BooleanArray 
10471045 new : a ndarray/object 
1048-  inplace : bool, default False 
1049-  Perform inplace modification. 
10501046 axis : int 
1051-  transpose : bool, default False 
1052-  Set to True if self is stored with axes reversed. 
10531047
10541048 Returns 
10551049 ------- 
10561050 List[Block] 
10571051 """ 
1052+  transpose  =  self .ndim  ==  2 
10581053 mask  =  _extract_bool_array (mask )
10591054 assert  not  isinstance (new , (ABCIndex , ABCSeries , ABCDataFrame ))
10601055
@@ -1091,8 +1086,6 @@ def putmask(
10911086 new  =  np .repeat (new , new_values .shape [- 1 ]).reshape (self .shape )
10921087 new  =  new .astype (new_values .dtype )
10931088
1094-  if  new_values  is  self .values  and  not  inplace :
1095-  new_values  =  new_values .copy ()
10961089 # we require exact matches between the len of the 
10971090 # values we are setting (or is compat). np.putmask 
10981091 # doesn't check this and will simply truncate / pad 
@@ -1113,6 +1106,7 @@ def putmask(
11131106 # `np.place` on the other hand uses the ``new`` values at it is 
11141107 # to place in the masked locations of ``new_values`` 
11151108 np .place (new_values , mask , new )
1109+  # i.e. new_values[mask] = new 
11161110 elif  mask .shape [- 1 ] ==  len (new ) or  len (new ) ==  1 :
11171111 np .putmask (new_values , mask , new )
11181112 else :
@@ -1157,18 +1151,10 @@ def f(mask, val, idx):
11571151 nv  =  _putmask_smart (val , mask , n )
11581152 return  nv 
11591153
1160-  new_blocks  =  self .split_and_operate (mask , f , inplace )
1154+  new_blocks  =  self .split_and_operate (mask , f , True )
11611155 return  new_blocks 
11621156
1163-  if  inplace :
1164-  return  [self ]
1165- 
1166-  if  transpose :
1167-  if  new_values  is  None :
1168-  new_values  =  self .values  if  inplace  else  self .values .copy ()
1169-  new_values  =  new_values .T 
1170- 
1171-  return  [self .make_block (new_values )]
1157+  return  [self ]
11721158
11731159 def  coerce_to_target_dtype (self , other ):
11741160 """ 
@@ -1711,17 +1697,13 @@ def set_inplace(self, locs, values):
17111697 assert  locs .tolist () ==  [0 ]
17121698 self .values  =  values 
17131699
1714-  def  putmask (
1715-  self , mask , new , inplace : bool  =  False , axis : int  =  0 , transpose : bool  =  False 
1716-  ) ->  List ["Block" ]:
1700+  def  putmask (self , mask , new , axis : int  =  0 ) ->  List ["Block" ]:
17171701 """ 
17181702 See Block.putmask.__doc__ 
17191703 """ 
1720-  inplace  =  validate_bool_kwarg (inplace , "inplace" )
1721- 
17221704 mask  =  _extract_bool_array (mask )
17231705
1724-  new_values  =  self .values   if   inplace   else   self . values . copy () 
1706+  new_values  =  self .values 
17251707
17261708 if  isinstance (new , (np .ndarray , ExtensionArray )) and  len (new ) ==  len (mask ):
17271709 new  =  new [mask ]
0 commit comments