Skip to content

CLN: remove unnecessary BoolBlock.replace #36966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,8 @@ def interpolate(

inplace = validate_bool_kwarg(inplace, "inplace")

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

# a fill na type method
Expand Down Expand Up @@ -2425,15 +2425,6 @@ def _can_hold_element(self, element: Any) -> bool:
return issubclass(tipo.type, np.bool_)
return isinstance(element, (bool, np.bool_))

def replace(self, to_replace, value, inplace=False, regex=False, convert=True):
inplace = validate_bool_kwarg(inplace, "inplace")
to_replace_values = np.atleast_1d(to_replace)
if not np.can_cast(to_replace_values, bool):
return self
return super().replace(
to_replace, value, inplace=inplace, regex=regex, convert=convert
)


class ObjectBlock(Block):
__slots__ = ()
Expand Down