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

IntegerArray.to_numpy #30792

Merged
merged 1 commit into from
Jan 8, 2020
Merged

Conversation

TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger commented Jan 7, 2020

This implements IntegerArray.to_numpy with similar semantics to BooleanArray.to_numpy. The implementation is now identical between BooleanArray & IntegerArray. #30789 will merge them.

  1. .to_numpy(dtype=float/bool/int) will raise if there are missing values
  2. .astype(float) will convert NA to NaN.

I've made a slight change from the BooleanArray implementation on master, which I'll annotate inline.

Closes #30038

@TomAugspurger TomAugspurger added API - Consistency Internal Consistency of API/Behavior ExtensionArray Extending pandas with custom dtypes or arrays. labels Jan 7, 2020
@TomAugspurger TomAugspurger added this to the 1.0 milestone Jan 7, 2020
@TomAugspurger TomAugspurger added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Jan 7, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm

@WillAyd WillAyd merged commit 8d8ff8f into pandas-dev:master Jan 8, 2020
@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2020

Thanks @TomAugspurger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior ExtensionArray Extending pandas with custom dtypes or arrays. Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: how to handle NA in conversion to numpy arrays
3 participants