Skip to content
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

BUG: Assignment of pyarrow arrays yield unexpected dtypes #58601

Open
wants to merge 47 commits into
base: main
Choose a base branch
from

Conversation

droussea2001
Copy link
Contributor

@droussea2001 droussea2001 commented May 6, 2024

During a column assignment in a DataFrame:

  • If the column value is a pyarrow array (check tested with lib.is_pyarrow_array) sanitize_array sets dtype to ArrowDtype(value.type)
  • Else the standard sanitize_array processing are applied

@droussea2001 droussea2001 marked this pull request as ready for review May 7, 2024 13:55
pandas/core/frame.py Outdated Show resolved Hide resolved
pandas/core/frame.py Outdated Show resolved Hide resolved
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jul 28, 2024
@droussea2001
Copy link
Contributor Author

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

I'm still working on it.

@droussea2001
Copy link
Contributor Author

@jorisvandenbossche : Hello Joris, hope you're doing well would you have any news about BUG: Assignment of pyarrow arrays yields unexpected dtypes ? Previously I was saying that "if a Series or a DataFrame is created or assigned with data dtype 'X' I would expect if it is possible, that it keeps the same 'X' dtype" but its only my humble opinion :-) and I would be equally happy to talk about it : maybe there is somewhere a discussion about how pyarrow types could be managed ? (thanks in advance !)

@rhshadrach
Copy link
Member

Friendly ping @jorisvandenbossche

@droussea2001
Copy link
Contributor Author

Hello @WillAyd: do you think this PR could be validated or should I have another approach ?

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Looks pretty good but a few things still needed I think. Thanks for keeping this concise

doc/source/whatsnew/v3.0.0.rst Outdated Show resolved Hide resolved
pandas/tests/extension/test_arrow.py Show resolved Hide resolved
pandas/core/construction.py Outdated Show resolved Hide resolved
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm although I see @jorisvandenbossche has some comments on the original issue. Let's clarify those before merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Assignment of pyarrow arrays yields unexpected dtypes
5 participants