Skip to content

Conversation

@lukemanley
Copy link
Member

@lukemanley lukemanley added Bug Arrow pyarrow functionality labels Aug 29, 2023
result[self.isna()] = na_value
else:
if dtype is None:
empty = data._pa_array[:0].to_numpy()
Copy link
Member

Choose a reason for hiding this comment

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

I think data.dtype.empty._pa_array would be a "nicer" way to get an empty example to use in can_hold_element

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, thanks. updated

if data._hasna:
result[data.isna()] = na_value
elif pa.types.is_null(pa_type):
if dtype is not None and dtype.kind != "O" and isna(na_value):
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to skip object here?

Copy link
Member Author

Choose a reason for hiding this comment

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

removed it, not needed

@mroeschke mroeschke added this to the 2.2 milestone Sep 1, 2023
@mroeschke mroeschke merged commit bc2888d into pandas-dev:main Sep 1, 2023
@mroeschke
Copy link
Member

Thanks @lukemanley

@lukemanley lukemanley deleted the arrow-to-numpy-without-dtype branch September 6, 2023 00:53
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Sep 11, 2023
…ovided (pandas-dev#54843)

* ENH: ArrowExtensionArray.to_numpy to avoid object dtype when na_value provided

* refactor

* cleanup

* mypy

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arrow pyarrow functionality Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: avoid conversion to object dtype in to_numpy for Arrow dtype and with dtype-compatible fill value

2 participants