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

Fix PandasArrayExtensionArray conversion to native type #1897

Merged
merged 2 commits into from
Feb 17, 2021

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Feb 17, 2021

To make the conversion to csv work in #1887 , we need PandasArrayExtensionArray used for multidimensional numpy arrays to be converted to pandas native types.
However previously pandas.core.internals.ExtensionBlock.to_native_types would fail with an PandasExtensionArray because

  1. the PandasExtensionArray.isna method was wrong
  2. the conversion of a PandasExtensionArray to a numpy array with dtype=object was returning a multidimensional array while pandas excepts a 1D array in this case (more info here)

I fixed these two issues and now the conversion to native types works, and so is the export to csv.
cc @SBrandeis

@lhoestq lhoestq merged commit 896949c into master Feb 17, 2021
@lhoestq lhoestq deleted the fix-PandasArrayExtension-conversion-to-native-type branch February 17, 2021 13:15
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.

None yet

1 participant