@@ -2418,12 +2418,13 @@ def _recursive_printoption(result, mask, printopt):
2418
2418
2419
2419
"""
2420
2420
names = result .dtype .names
2421
- for name in names :
2422
- (curdata , curmask ) = (result [name ], mask [name ])
2423
- if result .dtype [name ].names :
2421
+ if na
8000
mes :
2422
+ for name in names :
2423
+ curdata = result [name ]
2424
+ curmask = mask [name ]
2424
2425
_recursive_printoption (curdata , curmask , printopt )
2425
- else :
2426
- np .copyto (curdata , printopt , where = curmask )
2426
+ else :
2427
+ np .copyto (result , printopt , where = mask )
2427
2428
return
2428
2429
2429
2430
_print_templates = dict (long_std = """\
@@ -3832,25 +3833,22 @@ def __str__(self):
3832
3833
res = self ._data
3833
3834
else :
3834
3835
# convert to object array to make filled work
3835
- if self .dtype .names is None :
3836
- data = self ._data
3837
- # For big arrays, to avoid a costly conversion to the
3838
- # object dtype, extract the corners before the conversion.
3839
- print_width = (self ._print_width if self .ndim > 1
3840
- else self ._print_width_1d )
3841
- for axis in range (self .ndim ):
3842
- if data .shape [axis ] > print_width :
3843
- ind = print_width // 2
3844
- arr = np .split (data , (ind , - ind ), axis = axis )
3845
- data = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3846
- arr = np .split (mask , (ind , - ind ), axis = axis )
3847
- mask = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3848
- res = data .astype ("O" )
3849
- res .view (ndarray )[mask ] = masked_print_option
3850
- else :
3851
- rdtype = _replace_dtype_fields (self .dtype , "O" )
3852
- res = self ._data .astype (rdtype )
3853
- _recursive_printoption (res , mask , masked_print_option )
3836
+ data = self ._data
3837
+ # For big arrays, to avoid a costly conversion to the
3838
+ # object dtype, extract the corners before the conversion.
3839
+ print_width = (self ._print_width if self .ndim > 1
3840
+ else self ._print_width_1d )
3841
+ for axis in range (self .ndim ):
3842
+ if data .shape [axis ] > print_width :
3843
+ ind = print_width // 2
3844
+ arr = np .split (data , (ind , - ind ), axis = axis )
3845
+ data = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3846
+ arr = np .split (mask , (ind , - ind ), axis = axis )
3847
+ mask = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3848
+
3849
+ rdtype = _replace_dtype_fields (self .dtype , "O" )
3850
+ res = data .astype (rdtype )
3851
+ _recursive_printoption (res , mask , masked_print_option )
3854
3852
else :
3855
3853
res = self .filled (self .fill_value )
3856
3854
return str (res )
0 commit comments