@@ -43,6 +43,9 @@ def format_html(
43
43
) -> str :
44
44
"""Format record batches as HTML.
45
45
46
+ This method is used by DataFrame's _repr_html_ implementation and can be
47
+ called directly when custom HTML rendering is needed.
48
+
46
49
Args:
47
50
batches: List of Arrow RecordBatch objects
48
51
schema: Arrow Schema object
@@ -63,6 +66,7 @@ def format_html(
63
66
html .extend (self ._build_html_header ())
64
67
html .extend (self ._build_table_container_start ())
65
68
69
+ # Add table header and body
66
70
html .extend (self ._build_table_header (schema ))
67
71
html .extend (self ._build_table_body (batches , table_uuid ))
68
72
@@ -256,15 +260,27 @@ def _get_javascript(self) -> str:
256
260
257
261
258
262
def get_formatter () -> DataFrameHtmlFormatter :
259
- """Get the current global DataFrame HTML formatter."""
263
+ """Get the current global DataFrame HTML formatter.
264
+
265
+ This function is used by the DataFrame._repr_html_ implementation to access
266
+ the shared formatter instance. It can also be used directly when custom
267
+ HTML rendering is needed.
268
+
269
+ Returns:
270
+ The global HTML formatter instance
271
+ """
260
272
return _default_formatter
261
273
262
274
263
275
def configure_formatter (** kwargs : Any ) -> None :
264
276
"""Configure the global DataFrame HTML formatter.
265
277
278
+ This function creates a new formatter with the provided configuration
279
+ and sets it as the global formatter for all DataFrames.
280
+
266
281
Args:
267
- **kwargs: Formatter configuration parameters
282
+ **kwargs: Formatter configuration parameters like max_cell_length,
283
+ max_width, max_height, enable_cell_expansion, etc.
268
284
"""
269
285
global _default_formatter
270
286
_default_formatter = DataFrameHtmlFormatter (** kwargs )
0 commit comments