From b83710175040aeee8ede889793d298e69d2aadd7 Mon Sep 17 00:00:00 2001 From: Wouter Overmeire Date: Thu, 11 Oct 2012 21:01:34 +0200 Subject: [PATCH 1/2] BUG: fix Series repr when name is tuple holding non string-type --- pandas/core/format.py | 6 ++++-- pandas/tests/test_series.py | 13 ++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pandas/core/format.py b/pandas/core/format.py index dca1976be838f..af2d95ce94360 100644 --- a/pandas/core/format.py +++ b/pandas/core/format.py @@ -8,7 +8,8 @@ except: from io import StringIO -from pandas.core.common import adjoin, isnull, notnull, _stringify +from pandas.core.common import (adjoin, isnull, notnull, _stringify, + _stringify_seq) from pandas.core.index import MultiIndex, _ensure_index from pandas.util import py3compat @@ -85,7 +86,8 @@ def _get_footer(self): if isinstance(self.series.name, basestring): series_name = self.series.name elif isinstance(self.series.name, tuple): - series_name = "('%s')" % "', '".join(self.series.name) + series_name = "('%s')" % "', '".join( + _stringify_seq(self.series.name)) else: series_name = str(self.series.name) else: diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py index 3a28401fb4f15..19a9d0fc09a63 100644 --- a/pandas/tests/test_series.py +++ b/pandas/tests/test_series.py @@ -1011,9 +1011,16 @@ def test_repr(self): ots[::2] = None repr(ots) - # tuple name, e.g. from hierarchical index - self.series.name = ('foo', 'bar', 'baz') - repr(self.series) + # various names + for name in ['', 1, 1.2, 'foo', u'\u03B1\u03B2\u03B3', + 'loooooooooooooooooooooooooooooooooooooooooooooooooooong', + ('foo', 'bar', 'baz'), + (1, 2), + ('foo', 1, 2.3), + (u'\u03B1', u'\u03B2', u'\u03B3'), + (u'\u03B1', 'bar')]: + self.series.name = name + repr(self.series) biggie = Series(tm.randn(1000), index=np.arange(1000), name=('foo', 'bar', 'baz')) From 98861b785bc4dc58164082024863849c2a9b4799 Mon Sep 17 00:00:00 2001 From: Wouter Overmeire Date: Thu, 11 Oct 2012 21:12:11 +0200 Subject: [PATCH 2/2] DOC: update release notes, close #2051 --- RELEASE.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RELEASE.rst b/RELEASE.rst index bef84c4b02150..202e3ab9d67be 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -22,6 +22,20 @@ Where to get it * Binary installers on PyPI: http://pypi.python.org/pypi/pandas * Documentation: http://pandas.pydata.org +pandas 0.10.0 +============= + +**Release date:** not yet released + +**New features** + +**Improvements to existing features** + +**Bug fixes** + + - fix Series repr when name is tuple holding non string-type (#2051) + + pandas 0.9.0 ============