We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89bafd2 commit 78cf4d7Copy full SHA for 78cf4d7
pandas/core/arrays/arrow/array.py
@@ -11,7 +11,6 @@
11
TypeVar,
12
cast,
13
)
14
-import warnings
15
16
import numpy as np
17
@@ -890,12 +889,13 @@ def to_numpy(
890
889
result = np.empty(len(self), dtype=object)
891
mask = ~self.isna()
892
result[mask] = np.asarray(self[mask]._data)
+ elif self._hasna:
893
+ data = self.copy()
894
+ data[self.isna()] = na_value
895
+ return np.asarray(data._data, dtype=dtype)
896
else:
- with warnings.catch_warnings():
- # int dtype with NA raises Warning
- warnings.filterwarnings("ignore", category=RuntimeWarning)
897
- result = np.asarray(self._data, dtype=dtype)
898
- if copy or self._hasna:
+ result = np.asarray(self._data, dtype=dtype)
+ if copy:
899
result = result.copy()
900
if self._hasna:
901
result[self.isna()] = na_value
0 commit comments