@@ -291,6 +291,10 @@ def _repr_html_(self) -> str | None:
291
291
# Nested Column Formatting
292
292
# first cell shows the nested df header and a preview row
293
293
def repack_first_cell (chunk ):
294
+ # If the chunk is None, just return None
295
+ # Means that the column labels will not be shown
296
+ if chunk is None :
297
+ return None
294
298
# Render header separately to keep data aligned
295
299
output = chunk .head (0 ).to_html (
296
300
max_rows = 0 , max_cols = 5 , show_dimensions = False , index = False , header = True
@@ -301,6 +305,9 @@ def repack_first_cell(chunk):
301
305
302
306
# remaining cells show only a preview row
303
307
def repack_row (chunk ):
308
+ # If the chunk is None, just return None
309
+ if chunk is None :
310
+ return None
304
311
return chunk .to_html (max_rows = 1 , max_cols = 5 , show_dimensions = True , index = False , header = False )
305
312
306
313
# Apply repacking to all nested columns
@@ -312,7 +319,9 @@ def repack_row(chunk):
312
319
)
313
320
314
321
# Recover some truncation formatting, limited to head truncation
315
- if repr .data .shape [0 ] > pd .get_option ("display.max_rows" ):
322
+ if pd .get_option ("display.max_rows" ) is None :
323
+ return repr .to_html (max_rows = 0 )
324
+ elif repr .data .shape [0 ] > pd .get_option ("display.max_rows" ):
316
325
html_repr = repr .to_html (max_rows = pd .get_option ("display.min_rows" ))
317
326
else :
318
327
# when under the max_rows threshold, display all rows (behavior of 0 here)
0 commit comments