Skip to content

BUG: _tidy_repr should not be called when max_rows is None #6863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ Bug Fixes
- Bug in ``DataFrame.replace()`` where changing a dtype through replacement
would only replace the first occurrence of a value (:issue:`6689`)
- Better error message when passing a frequency of 'MS' in ``Period`` construction (GH5332)
- Bug in `Series.__unicode__` when `max_rows` is `None` and the Series has more than 1000 rows. (:issue:`6863`)

pandas 0.13.1
-------------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def __unicode__(self):
width, height = get_terminal_size()
max_rows = (height if get_option("display.max_rows") == 0
else get_option("display.max_rows"))
if len(self.index) > (max_rows or 1000):
if max_rows and len(self.index) > max_rows:
result = self._tidy_repr(min(30, max_rows - 4))
elif len(self.index) > 0:
result = self._get_repr(print_header=True,
Expand Down
5 changes: 5 additions & 0 deletions pandas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,11 @@ def test_repr_should_return_str(self):
df = Series(data, index=index1)
self.assertTrue(type(df.__repr__() == str)) # both py2 / 3

def test_repr_max_rows(self):
# GH 6863
with pd.option_context('max_rows', None):
str(Series(range(1001))) # should not raise exception

def test_unicode_string_with_unicode(self):
df = Series([u("\u05d0")], name=u("\u05d1"))
if compat.PY3:
Expand Down