@@ -126,8 +126,9 @@ class DataFrameHtmlFormatter:
126126 max_width: Maximum width of the HTML table in pixels
127127 max_height: Maximum height of the HTML table in pixels
128128 max_memory_bytes: Maximum memory in bytes for rendered data (default: 2MB)
129- min_rows_display: Minimum number of rows to display (must be <= repr_rows)
130- repr_rows: Default number of rows to display in repr output
129+ min_rows_display: Minimum number of rows to display (must be <= max_rows)
130+ max_rows: Maximum number of rows to display in repr output
131+ repr_rows: Deprecated alias for max_rows
131132 enable_cell_expansion: Whether to add expand/collapse buttons for long cell
132133 values
133134 custom_css: Additional CSS to include in the HTML output
@@ -144,7 +145,8 @@ def __init__(
144145 max_height : int = 300 ,
145146 max_memory_bytes : int = 2 * 1024 * 1024 , # 2 MB
146147 min_rows_display : int = 10 ,
147- repr_rows : int = 10 ,
148+ max_rows : int = 10 ,
149+ repr_rows : int | None = None ,
148150 enable_cell_expansion : bool = True ,
149151 custom_css : str | None = None ,
150152 show_truncation_message : bool = True ,
@@ -165,9 +167,11 @@ def __init__(
165167 Maximum memory in bytes for rendered data.
166168 min_rows_display : int, default 10
167169 Minimum number of rows to display. Must be less than or equal to
168- ``repr_rows``.
169- repr_rows : int, default 10
170- Default number of rows to display in repr output.
170+ ``max_rows``.
171+ max_rows : int, default 10
172+ Maximum number of rows to display in repr output.
173+ repr_rows : int, optional
174+ Deprecated alias for ``max_rows``. Use ``max_rows`` instead.
171175 enable_cell_expansion : bool, default True
172176 Whether to allow cells to expand when clicked.
173177 custom_css : str, optional
@@ -184,7 +188,7 @@ def __init__(
184188 ------
185189 ValueError
186190 If max_cell_length, max_width, max_height, max_memory_bytes,
187- min_rows_display, or repr_rows is not a positive integer.
191+ min_rows_display or max_rows is not a positive integer.
188192 TypeError
189193 If enable_cell_expansion, show_truncation_message, or use_shared_styles is
190194 not a boolean,
@@ -198,10 +202,19 @@ def __init__(
198202 _validate_positive_int (max_height , "max_height" )
199203 _validate_positive_int (max_memory_bytes , "max_memory_bytes" )
200204 _validate_positive_int (min_rows_display , "min_rows_display" )
201- _validate_positive_int (repr_rows , "repr_rows" )
202205
203- if min_rows_display > repr_rows :
204- msg = "min_rows_display must be less than or equal to repr_rows"
206+ if repr_rows is not None and repr_rows != max_rows :
207+ msg = "Specify only max_rows (repr_rows is deprecated)"
208+ raise ValueError (msg )
209+
210+ if repr_rows is not None :
211+ _validate_positive_int (repr_rows , "repr_rows" )
212+ max_rows = repr_rows
213+
214+ _validate_positive_int (max_rows , "max_rows" )
215+
216+ if min_rows_display > max_rows :
217+ msg = "min_rows_display must be less than or equal to max_rows"
205218 raise ValueError (msg )
206219
207220 # Validate boolean parameters
@@ -224,7 +237,9 @@ def __init__(
224237 self .max_height = max_height
225238 self .max_memory_bytes = max_memory_bytes
226239 self .min_rows_display = min_rows_display
227- self .repr_rows = repr_rows
240+ self .max_rows = max_rows
241+ # Backwards-compatible alias
242+ self .repr_rows = max_rows
228243 self .enable_cell_expansion = enable_cell_expansion
229244 self .custom_css = custom_css
230245 self .show_truncation_message = show_truncation_message
@@ -665,6 +680,7 @@ def configure_formatter(**kwargs: Any) -> None:
665680 "max_height" ,
666681 "max_memory_bytes" ,
667682 "min_rows_display" ,
683+ "max_rows" ,
668684 "repr_rows" ,
669685 "enable_cell_expansion" ,
670686 "custom_css" ,
0 commit comments