Skip to content

Commit af3ef4b

Browse files
committed
Refactor function parameter handling and documentation
Removed type annotations and redundant default values from parameter names. Enhanced descriptions for clarity and added context for usage. Fixed formatting for the documentation sections to improve readability.
1 parent 399e3e2 commit af3ef4b

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

python/datafusion/dataframe_formatter.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -245,43 +245,46 @@ def __init__(
245245
246246
Parameters
247247
----------
248-
max_cell_length : int, default 25
248+
max_cell_length
249249
Maximum length of cell content before truncation.
250-
max_width : int, default 1000
250+
max_width
251251
Maximum width of the displayed table in pixels.
252-
max_height : int, default 300
252+
max_height
253253
Maximum height of the displayed table in pixels.
254-
max_memory_bytes : int, default 2097152 (2MB)
255-
Maximum memory in bytes for rendered data.
256-
min_rows : int, default 10
257-
Minimum number of rows to display. Must be less than or equal to
258-
``max_rows``.
259-
max_rows : int, default 10
260-
Maximum number of rows to display in repr output.
261-
repr_rows : int, optional
254+
max_memory_bytes
255+
Maximum memory in bytes for rendered data. Helps prevent performance
256+
issues with large datasets.
257+
min_rows
258+
Minimum number of rows to display even if memory limit is reached.
259+
Must not exceed ``max_rows``.
260+
max_rows
261+
Maximum number of rows to display. Takes precedence over memory limits
262+
when fewer rows are requested.
263+
repr_rows
262264
Deprecated alias for ``max_rows``. Use ``max_rows`` instead.
263-
enable_cell_expansion : bool, default True
265+
enable_cell_expansion
264266
Whether to allow cells to expand when clicked.
265-
custom_css : str, optional
267+
custom_css
266268
Custom CSS to apply to the HTML table.
267-
show_truncation_message : bool, default True
269+
show_truncation_message
268270
Whether to show a message indicating that content has been truncated.
269-
style_provider : StyleProvider, optional
271+
style_provider
270272
Provider of CSS styles for the HTML table. If None, DefaultStyleProvider
271273
is used.
272-
use_shared_styles : bool, default True
273-
Whether to use shared styles across multiple tables.
274+
use_shared_styles
275+
Whether to use shared styles across multiple tables. This improves
276+
performance when displaying many DataFrames in a single notebook.
274277
275278
Raises:
276279
------
277280
ValueError
278281
If max_cell_length, max_width, max_height, max_memory_bytes,
279-
min_rows or max_rows is not a positive integer.
282+
min_rows or max_rows is not a positive integer, or if min_rows
283+
exceeds max_rows.
280284
TypeError
281285
If enable_cell_expansion, show_truncation_message, or use_shared_styles is
282-
not a boolean,
283-
or if custom_css is provided but is not a string,
284-
or if style_provider is provided but does not implement the StyleProvider
286+
not a boolean, or if custom_css is provided but is not a string, or if
287+
style_provider is provided but does not implement the StyleProvider
285288
protocol.
286289
"""
287290
# Validate all parameters and get resolved max_rows

0 commit comments

Comments
 (0)