Skip to content

CLN: unused case in compare_or_regex_search #36143

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
Sep 5, 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
14 changes: 4 additions & 10 deletions pandas/core/array_algos/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import operator
import re
from typing import Optional, Pattern, Union
from typing import Pattern, Union

import numpy as np

Expand All @@ -14,14 +14,10 @@
is_numeric_v_string_like,
is_scalar,
)
from pandas.core.dtypes.missing import isna


def compare_or_regex_search(
a: ArrayLike,
b: Union[Scalar, Pattern],
regex: bool = False,
mask: Optional[ArrayLike] = None,
a: ArrayLike, b: Union[Scalar, Pattern], regex: bool, mask: ArrayLike,
) -> Union[ArrayLike, bool]:
"""
Compare two array_like inputs of the same shape or two scalar values
Expand All @@ -33,8 +29,8 @@ def compare_or_regex_search(
----------
a : array_like
b : scalar or regex pattern
regex : bool, default False
mask : array_like or None (default)
regex : bool
mask : array_like

Returns
-------
Expand Down Expand Up @@ -68,8 +64,6 @@ def _check_comparison_types(
)

# GH#32621 use mask to avoid comparing to NAs
if mask is None and isinstance(a, np.ndarray) and not isinstance(b, np.ndarray):
mask = np.reshape(~(isna(a)), a.shape)
if isinstance(a, np.ndarray):
a = a[mask]

Expand Down