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 1111 TypeVar ,
1212 cast ,
1313)
14- import warnings
1514
1615import numpy as np
1716
@@ -890,12 +889,13 @@ def to_numpy(
890889 result = np .empty (len (self ), dtype = object )
891890 mask = ~ self .isna ()
892891 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 )
893896 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 :
899899 result = result .copy ()
900900 if self ._hasna :
901901 result [self .isna ()] = na_value
You can’t perform that action at this time.
0 commit comments