File tree 3 files changed +12
-2
lines changed 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1039,6 +1039,8 @@ pandas 0.10.1
1039
1039
- Fix Period resampling bug when all values fall into a single bin (:issue: `2070 `)
1040
1040
- Fix buggy interaction with usecols argument in read_csv when there is an
1041
1041
implicit first index column (:issue: `2654 `)
1042
+ - Fix bug in ``Index.summary() `` where string format methods were being called incorrectly.
1043
+ (:issue: `3869 `)
1042
1044
1043
1045
1044
1046
pandas 0.10.0
Original file line number Diff line number Diff line change @@ -310,10 +310,12 @@ def _has_complex_internals(self):
310
310
def summary (self , name = None ):
311
311
if len (self ) > 0 :
312
312
head = self [0 ]
313
- if hasattr (head ,'format' ):
313
+ if hasattr (head ,'format' ) and \
314
+ not isinstance (head , compat .string_types ):
314
315
head = head .format ()
315
316
tail = self [- 1 ]
316
- if hasattr (tail ,'format' ):
317
+ if hasattr (tail ,'format' ) and \
318
+ not isinstance (tail , compat .string_types ):
317
319
tail = tail .format ()
318
320
index_summary = ', %s to %s' % (com .pprint_thing (head ),
319
321
com .pprint_thing (tail ))
Original file line number Diff line number Diff line change @@ -418,6 +418,12 @@ def test_is_all_dates(self):
418
418
419
419
def test_summary (self ):
420
420
self ._check_method_works (Index .summary )
421
+ # GH3869
422
+ ind = Index (['{other}%s' ,"~:{range}:0" ], name = 'A' )
423
+ result = ind .summary ()
424
+ # shouldn't be formatted accidentally.
425
+ self .assert_ ('~:{range}:0' in result )
426
+ self .assert_ ('{other}%s' in result )
421
427
422
428
def test_format (self ):
423
429
self ._check_method_works (Index .format )
You can’t perform that action at this time.
0 commit comments