diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 8a6cad40765..ad2df0849c3 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -1226,7 +1226,7 @@ def __repr__(self): if get_option("display.max_rows") == 0 else get_option("display.max_rows") ) - if len(self) > max_rows and max_rows != 0: + if max_rows not in (0, None) and len(self) > max_rows: top = self.head(int(max_rows / 2 + 1)) bottom = self.tail(int(max_rows / 2 + 1)) preprocess = cudf.concat([top, bottom]) @@ -1254,7 +1254,7 @@ def __repr__(self): ): min_rows = ( height - if get_option("display.max_rows") == 0 + if get_option("display.min_rows") == 0 else get_option("display.min_rows") ) show_dimensions = get_option("display.show_dimensions") diff --git a/python/cudf/cudf/tests/test_repr.py b/python/cudf/cudf/tests/test_repr.py index d7b9f2fe1d7..093be41275a 100644 --- a/python/cudf/cudf/tests/test_repr.py +++ b/python/cudf/cudf/tests/test_repr.py @@ -86,12 +86,12 @@ def test_null_dataframe(ncols): @pytest.mark.parametrize("dtype", repr_categories) -@pytest.mark.parametrize("nrows", [0, 1, 2, 9, 10, 11, 19, 20, 21]) +@pytest.mark.parametrize("nrows", [None, 0, 1, 2, 9, 10, 11, 19, 20, 21]) def test_full_series(nrows, dtype): size = 20 ps = pd.Series(np.random.randint(0, 100, size)).astype(dtype) sr = cudf.from_pandas(ps) - pd.options.display.max_rows = int(nrows) + pd.options.display.max_rows = nrows assert ps.__repr__() == sr.__repr__() pd.reset_option("display.max_rows")