File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1063,21 +1063,23 @@ def format_values_with(float_format):
1063
1063
# default formatter leaves a space to the left when formatting
1064
1064
# floats, must be consistent for left-justifying NaNs (GH #25061)
1065
1065
if self .justify == 'left' :
1066
- self .na_rep = ' ' + self .na_rep
1066
+ na_rep = ' ' + self .na_rep
1067
+ else :
1068
+ na_rep = self .na_rep
1067
1069
1068
1070
# separate the wheat from the chaff
1069
1071
values = self .values
1070
1072
mask = isna (values )
1071
1073
if hasattr (values , 'to_dense' ): # sparse numpy ndarray
1072
1074
values = values .to_dense ()
1073
1075
values = np .array (values , dtype = 'object' )
1074
- values [mask ] = self . na_rep
1076
+ values [mask ] = na_rep
1075
1077
imask = (~ mask ).ravel ()
1076
1078
values .flat [imask ] = np .array ([formatter (val )
1077
1079
for val in values .ravel ()[imask ]])
1078
1080
1079
1081
if self .fixed_width :
1080
- return _trim_zeros (values , self . na_rep )
1082
+ return _trim_zeros (values , na_rep )
1081
1083
1082
1084
return values
1083
1085
You can’t perform that action at this time.
0 commit comments