diff --git a/doc/source/whatsnew/v0.25.2.rst b/doc/source/whatsnew/v0.25.2.rst
index 8d8a39139cf84..1cdf213d81a74 100644
--- a/doc/source/whatsnew/v0.25.2.rst
+++ b/doc/source/whatsnew/v0.25.2.rst
@@ -62,6 +62,7 @@ Missing
I/O
^^^
+- Fix regression in notebook display where
tags not used for :attr:`DataFrame.index` (:issue:`28204`).
- Regression in :meth:`~DataFrame.to_csv` where writing a :class:`Series` or :class:`DataFrame` indexed by an :class:`IntervalIndex` would incorrectly raise a ``TypeError`` (:issue:`28210`)
-
-
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 3d1a39a86c784..16fece1c7eb8b 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -671,10 +671,25 @@ def _repr_html_(self):
formatter = fmt.DataFrameFormatter(
self,
+ columns=None,
+ col_space=None,
+ na_rep="NaN",
+ formatters=None,
+ float_format=None,
+ sparsify=None,
+ justify=None,
+ index_names=True,
+ header=True,
+ index=True,
+ bold_rows=True,
+ escape=True,
max_rows=max_rows,
min_rows=min_rows,
max_cols=max_cols,
show_dimensions=show_dimensions,
+ decimal=".",
+ table_id=None,
+ render_links=False,
)
return formatter.to_html(notebook=True)
else:
diff --git a/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_12.html b/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_12.html
new file mode 100644
index 0000000000000..4eb3f5319749d
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_12.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ 2 |
+ 2 |
+
+
+ 3 |
+ 3 |
+
+
+ 4 |
+ 4 |
+
+
+ ... |
+ ... |
+
+
+ 56 |
+ 56 |
+
+
+ 57 |
+ 57 |
+
+
+ 58 |
+ 58 |
+
+
+ 59 |
+ 59 |
+
+
+ 60 |
+ 60 |
+
+
+
+ 61 rows × 1 columns
+
diff --git a/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_4.html b/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_4.html
new file mode 100644
index 0000000000000..2b1d97aec517c
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_max_rows_10_min_rows_4.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ ... |
+ ... |
+
+
+ 59 |
+ 59 |
+
+
+ 60 |
+ 60 |
+
+
+
+ 61 rows × 1 columns
+
diff --git a/pandas/tests/io/formats/data/html/html_repr_max_rows_12_min_rows_None.html b/pandas/tests/io/formats/data/html/html_repr_max_rows_12_min_rows_None.html
new file mode 100644
index 0000000000000..a539e5a4884a1
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_max_rows_12_min_rows_None.html
@@ -0,0 +1,78 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ 2 |
+ 2 |
+
+
+ 3 |
+ 3 |
+
+
+ 4 |
+ 4 |
+
+
+ 5 |
+ 5 |
+
+
+ ... |
+ ... |
+
+
+ 55 |
+ 55 |
+
+
+ 56 |
+ 56 |
+
+
+ 57 |
+ 57 |
+
+
+ 58 |
+ 58 |
+
+
+ 59 |
+ 59 |
+
+
+ 60 |
+ 60 |
+
+
+
+ 61 rows × 1 columns
+
diff --git a/pandas/tests/io/formats/data/html/html_repr_max_rows_None_min_rows_12.html b/pandas/tests/io/formats/data/html/html_repr_max_rows_None_min_rows_12.html
new file mode 100644
index 0000000000000..3e680a505c6d6
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_max_rows_None_min_rows_12.html
@@ -0,0 +1,269 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ 2 |
+ 2 |
+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
+
+
+ 60 |
+ 60 |
+
+
+
+
diff --git a/pandas/tests/io/formats/data/html/html_repr_min_rows_default_no_truncation.html b/pandas/tests/io/formats/data/html/html_repr_min_rows_default_no_truncation.html
new file mode 100644
index 0000000000000..10f6247e37def
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_min_rows_default_no_truncation.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ 2 |
+ 2 |
+
+
+ 3 |
+ 3 |
+
+
+ 4 |
+ 4 |
+
+
+ 5 |
+ 5 |
+
+
+ 6 |
+ 6 |
+
+
+ 7 |
+ 7 |
+
+
+ 8 |
+ 8 |
+
+
+ 9 |
+ 9 |
+
+
+ 10 |
+ 10 |
+
+
+ 11 |
+ 11 |
+
+
+ 12 |
+ 12 |
+
+
+ 13 |
+ 13 |
+
+
+ 14 |
+ 14 |
+
+
+ 15 |
+ 15 |
+
+
+ 16 |
+ 16 |
+
+
+ 17 |
+ 17 |
+
+
+ 18 |
+ 18 |
+
+
+ 19 |
+ 19 |
+
+
+
+
diff --git a/pandas/tests/io/formats/data/html/html_repr_min_rows_default_truncated.html b/pandas/tests/io/formats/data/html/html_repr_min_rows_default_truncated.html
new file mode 100644
index 0000000000000..4eb3f5319749d
--- /dev/null
+++ b/pandas/tests/io/formats/data/html/html_repr_min_rows_default_truncated.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+ |
+ a |
+
+
+
+
+ 0 |
+ 0 |
+
+
+ 1 |
+ 1 |
+
+
+ 2 |
+ 2 |
+
+
+ 3 |
+ 3 |
+
+
+ 4 |
+ 4 |
+
+
+ ... |
+ ... |
+
+
+ 56 |
+ 56 |
+
+
+ 57 |
+ 57 |
+
+
+ 58 |
+ 58 |
+
+
+ 59 |
+ 59 |
+
+
+ 60 |
+ 60 |
+
+
+
+ 61 rows × 1 columns
+
diff --git a/pandas/tests/io/formats/test_to_html.py b/pandas/tests/io/formats/test_to_html.py
index 448e869df950d..52c7b89220f06 100644
--- a/pandas/tests/io/formats/test_to_html.py
+++ b/pandas/tests/io/formats/test_to_html.py
@@ -713,3 +713,42 @@ def test_to_html_with_col_space_units(unit):
for h in hdrs:
expected = ' | '.format(unit=unit)
assert expected in h
+
+
+def test_html_repr_min_rows_default(datapath):
+ # gh-27991
+
+ # default setting no truncation even if above min_rows
+ df = pd.DataFrame({"a": range(20)})
+ result = df._repr_html_()
+ expected = expected_html(datapath, "html_repr_min_rows_default_no_truncation")
+ assert result == expected
+
+ # default of max_rows 60 triggers truncation if above
+ df = pd.DataFrame({"a": range(61)})
+ result = df._repr_html_()
+ expected = expected_html(datapath, "html_repr_min_rows_default_truncated")
+ assert result == expected
+
+
+@pytest.mark.parametrize(
+ "max_rows,min_rows,expected",
+ [
+ # truncated after first two rows
+ (10, 4, "html_repr_max_rows_10_min_rows_4"),
+ # when set to None, follow value of max_rows
+ (12, None, "html_repr_max_rows_12_min_rows_None"),
+ # when set value higher as max_rows, use the minimum
+ (10, 12, "html_repr_max_rows_10_min_rows_12"),
+ # max_rows of None -> never truncate
+ (None, 12, "html_repr_max_rows_None_min_rows_12"),
+ ],
+)
+def test_html_repr_min_rows(datapath, max_rows, min_rows, expected):
+ # gh-27991
+
+ df = pd.DataFrame({"a": range(61)})
+ expected = expected_html(datapath, expected)
+ with option_context("display.max_rows", max_rows, "display.min_rows", min_rows):
+ result = df._repr_html_()
+ assert result == expected
|