File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 11
11
TypeVar ,
12
12
cast ,
13
13
)
14
- import warnings
15
14
16
15
import numpy as np
17
16
@@ -890,12 +889,13 @@ def to_numpy(
890
889
result = np .empty (len (self ), dtype = object )
891
890
mask = ~ self .isna ()
892
891
result [mask ] = np .asarray (self [mask ]._data )
892
+ elif self ._hasna :
893
+ data = self .copy ()
894
+ data [self .isna ()] = na_value
895
+ return np .asarray (data ._data , dtype = dtype )
893
896
else :
894
- with warnings .catch_warnings ():
895
- # int dtype with NA raises Warning
896
- warnings .filterwarnings ("ignore" , category = RuntimeWarning )
897
- result = np .asarray (self ._data , dtype = dtype )
898
- if copy or self ._hasna :
897
+ result = np .asarray (self ._data , dtype = dtype )
898
+ if copy :
899
899
result = result .copy ()
900
900
if self ._hasna :
901
901
result [self .isna ()] = na_value
You can’t perform that action at this time.
0 commit comments