BUG: Handle zero-chunked pyarrow.ChunkedArray in StringArray#41052
BUG: Handle zero-chunked pyarrow.ChunkedArray in StringArray#41052jorisvandenbossche merged 5 commits intopandas-dev:masterfrom
Conversation
xhochy
commented
Apr 20, 2021
- 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, |
jorisvandenbossche
left a comment
There was a problem hiding this comment.
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.
| results.append(bool_arr) | ||
|
|
||
| return BooleanArray._concat_same_type(results) | ||
| if not results: |
There was a problem hiding this comment.
| if not results: | |
| if len(results) == 0: |
? (I find that more explicit / readable)
There was a problem hiding this comment.
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.
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.
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 ! |