@@ -254,7 +254,7 @@ def _get_formatted_values(self):
254
254
values_to_format = self .tr_series ._formatting_values ()
255
255
256
256
if self .index :
257
- leading_space = None
257
+ leading_space = 'compat'
258
258
else :
259
259
leading_space = False
260
260
return format_array (values_to_format , None ,
@@ -712,7 +712,7 @@ def _format_col(self, i):
712
712
values_to_format = frame .iloc [:, i ]._formatting_values ()
713
713
714
714
if self .index :
715
- leading_space = None
715
+ leading_space = 'compat'
716
716
else :
717
717
leading_space = False
718
718
return format_array (values_to_format , formatter ,
@@ -860,7 +860,7 @@ def _get_column_name_list(self):
860
860
861
861
def format_array (values , formatter , float_format = None , na_rep = 'NaN' ,
862
862
digits = None , space = None , justify = 'right' , decimal = '.' ,
863
- leading_space = None ):
863
+ leading_space = 'compat' ):
864
864
"""
865
865
Format an array for printing.
866
866
@@ -874,7 +874,7 @@ def format_array(values, formatter, float_format=None, na_rep='NaN',
874
874
space
875
875
justify
876
876
decimal
877
- leading_space : bool, optional
877
+ leading_space : bool, default is 'compat'
878
878
Whether the array should be formatted with a leading space.
879
879
When an array as a column of a Series or DataFrame, we do want
880
880
the leading space to pad between columns.
@@ -924,7 +924,7 @@ class GenericArrayFormatter(object):
924
924
925
925
def __init__ (self , values , digits = 7 , formatter = None , na_rep = 'NaN' ,
926
926
space = 12 , float_format = None , justify = 'right' , decimal = '.' ,
927
- quoting = None , fixed_width = True , leading_space = None ):
927
+ quoting = None , fixed_width = True , leading_space = 'compat' ):
928
928
self .values = values
929
929
self .digits = digits
930
930
self .na_rep = na_rep
@@ -976,12 +976,12 @@ def _format(x):
976
976
977
977
is_float_type = lib .map_infer (vals , is_float ) & notna (vals )
978
978
leading_space = self .leading_space
979
- if leading_space is None :
979
+ if leading_space == 'compat' :
980
980
leading_space = is_float_type .any ()
981
981
982
982
fmt_values = []
983
983
for i , v in enumerate (vals ):
984
- if not is_float_type [i ] and leading_space :
984
+ if not is_float_type [i ] and leading_space is True :
985
985
fmt_values .append (u' {v}' .format (v = _format (v )))
986
986
elif is_float_type [i ]:
987
987
fmt_values .append (float_format (v ))
0 commit comments