-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Handle zero-chunked pyarrow.ChunkedArray in StringArray #41052
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
- closes BUG: Cannot construct StringArray from pyarrow.ChunkedArray with zero chunks #41040
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
The test failure on Windows is unrelated and also happening on master. |
This happens sometimes, |
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.
Thanks for working on this!
Period and Interval might have the same problem (but also fine to leave it as follow-up)
I was kind of wondering if _concat_same_type
should be able to handle the "empty list of arrays" case. But in the current implementation (as a class method on the EA, without access to the actual dtype
instance), that's not possible, because it wouldn't know the dtype for the resulting array.
@@ -126,7 +126,12 @@ def __from_arrow__( | |||
bool_arr = BooleanArray._from_sequence(np.array(arr)) | |||
results.append(bool_arr) | |||
|
|||
return BooleanArray._concat_same_type(results) | |||
if not results: |
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.
if not results: | |
if len(results) == 0: |
? (I find that more explicit / readable)
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.
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.
Whoops, missed that comment. Sorry for the contradicting feedback ;)
(let's leave it for now then, something to discuss / agree on as pandas team)
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.
Saw this on a few prs in the past that either not was used or it was recommended to use not, hence my feedback, sorry if I misinterpreted this
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.
sorry if I misinterpreted this
No, no, nothing to be sorry about! I know that others prefer that and give that feedback, I personally just don't agree with it being a better style ;)
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
I'll fix that here, too. |
Thanks @xhochy ! |