Skip to content

CLN: Switch to using is not None rather than bool() #32721

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
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
4 changes: 2 additions & 2 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def str_contains(arr, pat, case=True, flags=0, na=np.nan, regex=True):
stacklevel=3,
)

f = lambda x: bool(regex.search(x))
f = lambda x: regex.search(x) is not None
else:
if case:
f = lambda x: pat in x
Expand Down Expand Up @@ -818,7 +818,7 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan):
regex = re.compile(pat, flags=flags)

dtype = bool
f = lambda x: bool(regex.match(x))
f = lambda x: regex.match(x) is not None

return _na_map(f, arr, na, dtype=dtype)

Expand Down