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 14 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, sanitize_array is called with a dtype equals to ArrowDtype(value.type) if the column value is a pa.lib._PandasConvertible (else the standard behaviour is kept)

@droussea2001 droussea2001 marked this pull request as ready for review May 7, 2024 13:55
from pandas.compat._constants import REF_COUNT
from pandas.compat._optional import import_optional_dependency
from pandas.compat.numpy import function as nv

if not pa_version_under11p0:
Copy link
Member

Choose a reason for hiding this comment

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

What prevents this from working with pyarrow 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing prevents it ! :-)

It was a misanderstanding.

At the beginning I thought that the version 11.0.0 was the minimum version (because "Minimum Versions" tests in the CI were not working with pyarrow 10). But actually value in _sanitize_column is:

  • A pa.lib.ChunkedArray in version 10.0.1
  • A pa.lib.Array in versions above
    So now I just test if value is an instance of the parent class pa.lib._PandasConvertible

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

Successfully merging this pull request may close these issues.

BUG: Assignment of pyarrow arrays yields unexpected dtypes
2 participants