8000 BUG: Handle zero-chunked pyarrow.ChunkedArray in StringArray by xhochy · Pull Request #41052 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 5 commits into from
Apr 21, 2021

Conversation

xhochy
Copy link
Contributor
@xhochy xhochy commented Apr 20, 2021

@xhochy
Copy link
Contributor Author
xhochy commented Apr 20, 2021

The test failure on Windows is unrelated and also happening on master.

@phofl
Copy link
Member
phofl commented Apr 20, 2021

This happens sometimes, ResourceWarning yes

@lithomas1 lithomas1 added this to the 1.3 milestone Apr 20, 2021
@lithomas1 lithomas1 added the Strings String extension data type and string data label Apr 20, 2021
Copy link
Member
@jorisvandenbossche jorisvandenbossche left a 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not results:
if len(results) == 0:

? (I find that more explicit / readable)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can simply revert f4a2c8c (did do that commit as @phofl suggested)

Copy link
Member

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)

Copy link
Member

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

Copy link
Member

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>
@xhochy
Copy link
Contributor Author
xhochy commented Apr 21, 2021

Period and Interval might have the same problem (but also fine to leave it as follow-up)

I'll fix that here, too.

@jorisvandenbossche jorisvandenbossche merged commit 1fb626d into pandas-dev:master Apr 21, 2021
@jorisvandenbossche
Copy link
Member

Thanks @xhochy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Parquet parquet, feather Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Cannot construct StringArray from pyarrow.ChunkedArray with zero chunks
4 participants
0