Skip to content

CLN: remove align kwarg from Block.where, Block.putmask #32791

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 2 commits into from
Mar 22, 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
37 changes: 5 additions & 32 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,7 @@ def setitem(self, indexer, value):
return block

def putmask(
self,
mask,
new,
align: bool = True,
inplace: bool = False,
axis: int = 0,
transpose: bool = False,
self, mask, new, inplace: bool = False, axis: int = 0, transpose: bool = False,
):
"""
putmask the data to the block; it is possible that we may create a
Expand All @@ -927,7 +921,6 @@ def putmask(
----------
mask : the condition to respect
new : a ndarray/object
align : boolean, perform alignment on other/cond, default is True
inplace : perform inplace modification, default is False
axis : int
transpose : boolean
Expand Down Expand Up @@ -1312,13 +1305,7 @@ def shift(self, periods, axis: int = 0, fill_value=None):
return [self.make_block(new_values)]

def where(
self,
other,
cond,
align: bool = True,
errors="raise",
try_cast: bool = False,
axis: int = 0,
self, other, cond, errors="raise", try_cast: bool = False, axis: int = 0,
) -> List["Block"]:
"""
evaluate the block; return result block(s) from the result
Expand All @@ -1327,8 +1314,6 @@ def where(
----------
other : a ndarray/object
cond : the condition to respect
align : bool, default True
Perform alignment on other/cond.
errors : str, {'raise', 'ignore'}, default 'raise'
- ``raise`` : allow exceptions to be raised
- ``ignore`` : suppress exceptions. On error return original object
Expand Down Expand Up @@ -1394,12 +1379,7 @@ def where_func(cond, values, other):
# we are explicitly ignoring errors
block = self.coerce_to_target_dtype(other)
blocks = block.where(
orig_other,
cond,
align=align,
errors=errors,
try_cast=try_cast,
axis=axis,
orig_other, cond, errors=errors, try_cast=try_cast, axis=axis,
)
return self._maybe_downcast(blocks, "infer")

Expand Down Expand Up @@ -1646,7 +1626,7 @@ def set(self, locs, values):
self.values[:] = values

def putmask(
self, mask, new, align=True, inplace=False, axis=0, transpose=False,
self, mask, new, inplace=False, axis=0, transpose=False,
):
"""
putmask the data to the block; we must be a single block and not
Expand All @@ -1658,7 +1638,6 @@ def putmask(
----------
mask : the condition to respect
new : a ndarray/object
align : boolean, perform alignment on other/cond, default is True
inplace : perform inplace modification, default is False

Returns
Expand Down Expand Up @@ -1896,13 +1875,7 @@ def shift(
]

def where(
self,
other,
cond,
align=True,
errors="raise",
try_cast: bool = False,
axis: int = 0,
self, other, cond, errors="raise", try_cast: bool = False, axis: int = 0,
) -> List["Block"]:
if isinstance(other, ABCDataFrame):
# ExtensionArrays are 1-D, so if we get here then
Expand Down