@@ -3827,30 +3827,13 @@ def __str__(self):
3827
3827
3828
3828
"""
3829
3829
if masked_print_option .enabled ():
3830
- f = masked_print_option
3831
- if self is masked :
3832
- return str (f )
3833
- m = self ._mask
3834
- if m is nomask :
3830
+ mask = self ._mask
3831
+ if mask is nomask :
3835
3832
res = self ._data
3836
3833
else :
3837
- if m .shape == () and m .itemsize == len (m .dtype ):
3838
- if m .dtype .names :
3839
- m = m .view ((bool , len (m .dtype )))
3840
- if m .any ():
3841
- return str (tuple ((f if _m else _d ) for _d , _m in
3842
- zip (self ._data .tolist (), m )))
3843
- else :
3844
- return str (self ._data )
3845
- elif m :
3846
- return str (f )
3847
- else :
3848
- return str (self ._data )
3849
3834
# convert to object array to make filled work
3850
- names = self .dtype .names
3851
- if names is None :
3835
+ if self .dtype .names is None :
3852
3836
data = self ._data
3853
- mask = m
3854
3837
# For big arrays, to avoid a costly conversion to the
3855
3838
# object dtype, extract the corners before the conversion.
3856
3839
print_width = (self ._print_width if self .ndim > 1
@@ -3863,11 +3846,11 @@ def __str__(self):
3863
3846
arr = np .split (mask , (ind , - ind ), axis = axis )
3864
3847
mask = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3865
3848
res = data .astype ("O" )
3866
- res .view (ndarray )[mask ] = f
3849
+ res .view (ndarray )[mask ] = masked_print_option
3867
3850
else :
3868
3851
rdtype = _replace_dtype_fields (self .dtype , "O" )
3869
3852
res = self ._data .astype (rdtype )
3870
- _recursive_printoption (res , m , f )
3853
+ _recursive_printoption (res , mask , masked_print_option )
3871
3854
else :
3872
3855
res = self .filled (self .fill_value )
3873
3856
return str (res )
0 commit comments