We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
In [7]: pd.Series([], dtype=object).str.isalnum() Out[7]: Series([], dtype: object)
On empty series, we return an object-dtype result, rather than bool. I might expect this to be a boolean dtype to match the non-empty case.
In [14]: pd.Series([], dtype=object).str.isalnum() Out[14]: Series([], dtype: bool)
The text was updated successfully, but these errors were encountered:
Given that other boolean-returning methods do return a bool dtype for empty Series, I'm comfortable calling this a bug:
In [5]: pd.Series([], dtype=object).str.contains("a") Out[5]: Series([], dtype: bool)
Sorry, something went wrong.
It looks to me like this can be solved by adding dtype=bool as an argument to _noarg_wrapper for the "ismethods" the StringMethods class:
dtype=bool
_noarg_wrapper
isalnum = _noarg_wrapper( lambda x: x.isalnum(), name="isalnum", docstring=_shared_docs["ismethods"] % _doc_args["isalnum"], returns_string=False, dtype=bool, )
Successfully merging a pull request may close this issue.
Code Sample, a copy-pastable example if possible
Problem description
On empty series, we return an object-dtype result, rather than bool. I might expect
this to be a boolean dtype to match the non-empty case.
Expected Output
The text was updated successfully, but these errors were encountered: