Skip to content

Commit 7eb6d2f

Browse files
authored
CLN: remove unnecessary BoolBlock.replace (#36966)
1 parent 39a0534 commit 7eb6d2f

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

pandas/core/internals/blocks.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,8 @@ def interpolate(
11731173

11741174
inplace = validate_bool_kwarg(inplace, "inplace")
11751175

1176-
# Only FloatBlocks will contain NaNs. timedelta subclasses IntBlock
1177-
if (self.is_bool or self.is_integer) and not self.is_timedelta:
1176+
if not self._can_hold_na:
1177+
# If there are no NAs, then interpolate is a no-op
11781178
return self if inplace else self.copy()
11791179

11801180
# a fill na type method
@@ -2427,15 +2427,6 @@ def _can_hold_element(self, element: Any) -> bool:
24272427
return issubclass(tipo.type, np.bool_)
24282428
return isinstance(element, (bool, np.bool_))
24292429

2430-
def replace(self, to_replace, value, inplace=False, regex=False, convert=True):
2431-
inplace = validate_bool_kwarg(inplace, "inplace")
2432-
to_replace_values = np.atleast_1d(to_replace)
2433-
if not np.can_cast(to_replace_values, bool):
2434-
return self
2435-
return super().replace(
2436-
to_replace, value, inplace=inplace, regex=regex, convert=convert
2437-
)
2438-
24392430

24402431
class ObjectBlock(Block):
24412432
__slots__ = ()

0 commit comments

Comments
 (0)