8000 doc: enhance docstrings for DataFrameHtmlFormatter methods to clarify… · kosiew/datafusion-python@d9980c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9980c3

Browse files
committed
doc: enhance docstrings for DataFrameHtmlFormatter methods to clarify usage
1 parent 42c7c45 commit d9980c3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

python/datafusion/html_formatter.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def format_html(
4343
) -> str:
4444
"""Format record batches as HTML.
4545
46+
This method is used by DataFrame's _repr_html_ implementation and can be
47+
called directly when custom HTML rendering is needed.
48+
4649
Args:
4750
batches: List of Arrow RecordBatch objects
4851
schema: Arrow Schema object
@@ -63,6 +66,7 @@ def format_html(
6366
html.extend(self._build_html_header())
6467
html.extend(self._build_table_container_start())
6568

69+
# Add table header and body
6670
html.extend(self._build_table_header(schema))
6771
html.extend(self._build_table_body(batches, table_uuid))
6872

@@ -256,15 +260,27 @@ def _get_javascript(self) -> str:
256260

257261

258262
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+
"""
260272
return _default_formatter
261273

262274

263275
def configure_formatter(**kwargs: Any) -> None:
264276
"""Configure the global DataFrame HTML formatter.
265277
278+
This function creates a new formatter with the provided configuration
279+
and sets it as the global formatter for all DataFrames.
280+
266281
Args:
267-
**kwargs: Formatter configuration parameters
282+
**kwargs: Formatter configuration parameters like max_cell_length,
283+
max_width, max_height, enable_cell_expansion, etc.
268284
"""
269285
global _default_formatter
270286
_default_formatter = DataFrameHtmlFormatter(**kwargs)

0 commit comments

Comments
 (0)
0