-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Handle construction of string ExtensionArray from lists #27674
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
Handle construction of string ExtensionArray from lists #27674
Conversation
Thanks. I'm wondering a bit more general fix. What about something like # in sanitize_array. Somewhere before `data = extract_array(...)`
if not is_array_like(data) and is_extension_array_dtype(dtype):
data = dtype.construct_array_type()._from_sequence(data, dtype=dtype, copy=copy) Would that work? Then we get to the EA handling earlier on, and don't require special casing later on. |
I moved the check slightly up but didn't move it significantly up as the above code could actually be taken by ExtensionArray data. If I run into other issues, I would revisit this if I run into other problems while workin on |
OK, thanks. @jbrockmendel can you take a look at this? |
self._dtype = ArrowBoolDtype() | ||
|
||
def __repr__(self): | ||
return "ArrowBoolArray({})".format(repr(self._data)) |
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.
might as well share this method by using "{cls}({data})".format(cls=type(self).__name__, data=repr(self._data))
small comment, otherwise looks good |
da473b4
to
2f53e34
Compare
@jbrockmendel Adapted that but Travis keeps faling for unrelated reasons. |
2f53e34
to
3f30c15
Compare
Rebased on master and everything is green now. |
Thanks @xhochy ! |
I had to add a string-based Arrow Extension array to trigger the bug but did not run the same test suite as we do on the boolean array as I don't see it adding value but just runtime at the moment.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff