-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
support tuple in startswith/endswith for arrow strings #56580
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
Conversation
result = getattr(ser.str, side)(pat, na=na) | ||
expected = pd.Series(exp, dtype=ArrowDtype(pa.bool_())) | ||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
@pytest.mark.parametrize("side", ("startswith", "endswith")) | ||
def test_str_starts_ends_with_all_nulls_empty_tuple(side): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this test because in case of empty tuple, code to create series is:
result = pc.if_else(pc.is_null(self._pa_array), None, False)
I thought that if self._pa_array was all nulls, that resulting datatype may be null[pyarrow] (when we want bool[pyarrow]), I added this test to validate that bool is preserved, even in all nulls case.
Co-authored-by: Xiao Yuan <yuanx749@gmail.com>
Co-authored-by: Xiao Yuan <yuanx749@gmail.com>
thx @rohanjain101 |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.