8000 ENH: add ExtensionArray.to_numpy to have control over conversion to numpy array by jorisvandenbossche · Pull Request #30322 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: add ExtensionArray.to_numpy to have control over conversion to numpy array #30322

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

Merged
merged 18 commits into from
Jan 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into NA-to_numpy
  • Loading branch information
TomAugspurger committed Jan 3, 2020
commit bf9592cb613490837c89c958aa86f50ceeb84b34
4 changes: 2 additions & 2 deletions pandas/core/arrays/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def to_numpy(self, dtype=None, copy=False, na_value: "Scalar" = libmissing.NA):
"""
if dtype is None:
dtype = object
if self.isna().any():
if self._hasna:
if is_bool_dtype(dtype) and na_value is libmissing.NA:
raise ValueError(
"cannot convert to bool numpy array in presence of missing values"
Expand Down Expand Up @@ -550,7 +550,7 @@ def astype(self, dtype, copy=True):
na_value = np.nan
# coerce
data = self.to_numpy(na_value=na_value)
return astype_nansafe(data, dtype, copy=None)
return astype_nansafe(data, dtype, copy=False)

def value_counts(self, dropna=True):
"""
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0