File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 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
10391039 - Fix Period resampling bug when all values fall into a single bin (:issue: `2070 `)
10401040 - Fix buggy interaction with usecols argument in read_csv when there is an
10411041 implicit first index column (:issue: `2654 `)
1042+ - Fix bug in ``Index.summary() `` where string format methods were being called incorrectly.
1043+ (:issue: `3869 `)
10421044
10431045
10441046pandas 0.10.0
Original file line number Diff line number Diff line change @@ -310,10 +310,12 @@ def _has_complex_internals(self):
310310 def summary (self , name = None ):
311311 if len (self ) > 0 :
312312 head = self [0 ]
313- if hasattr (head ,'format' ):
313+ if hasattr (head ,'format' ) and \
314+ not isinstance (head , compat .string_types ):
314315 head = head .format ()
315316 tail = self [- 1 ]
316- if hasattr (tail ,'format' ):
317+ if hasattr (tail ,'format' ) and \
318+ not isinstance (tail , compat .string_types ):
317319 tail = tail .format ()
318320 index_summary = ', %s to %s' % (com .pprint_thing (head ),
319321 com .pprint_thing (tail ))
Original file line number Diff line number Diff line change @@ -418,6 +418,12 @@ def test_is_all_dates(self):
418418
419419 def test_summary (self ):
420420 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 )
421427
422428 def test_format (self ):
423429 self ._check_method_works (Index .format )
You can’t perform that action at this time.
0 commit comments