@@ -4415,26 +4415,25 @@ def _clip_with_scalar(self, lower, upper, inplace=False):
4415
4415
4416
4416
def _clip_with_one_bound (self , threshold , method , axis , inplace ):
4417
4417
4418
+ inplace = validate_bool_kwarg (inplace , 'inplace' )
4419
+
4418
4420
if np .any (isnull (threshold )):
4419
4421
raise ValueError ("Cannot use an NA value as a clip threshold" )
4420
4422
4421
4423
# method is self.le for upper bound and self.ge for lower bound
4422
4424
if is_scalar (threshold ) and is_number (threshold ):
4423
4425
if method .__name__ == 'le' :
4424
4426
return self ._clip_with_scalar (None , threshold , inplace = inplace )
4425
- else :
4426
- return self ._clip_with_scalar (threshold , None , inplace = inplace )
4427
-
4428
- inplace = validate_bool_kwarg (inplace , 'inplace' )
4427
+ return self ._clip_with_scalar (threshold , None , inplace = inplace )
4429
4428
4430
4429
subset = method (threshold , axis = axis ) | isnull (self )
4431
4430
4432
4431
# GH #15390
4433
- if is_scalar (threshold ) or is_number ( threshold ) :
4432
+ if is_scalar (threshold ):
4434
4433
return self .where (subset , threshold , axis = axis , inplace = inplace )
4435
4434
4436
4435
# For arry_like threshold, convet it to Series with corret index
4437
- # `where` only takes
4436
+ # `where` takes scalar, NDFrame, or callable for argument "other"
4438
4437
try :
4439
4438
if isinstance (subset , ABCSeries ):
4440
4439
threshold = pd .Series (threshold , index = subset .index )
0 commit comments