From 175dd3651a3cf7fa9d630f2a12e2edda9dee8438 Mon Sep 17 00:00:00 2001 From: hlakams Date: Mon, 26 Aug 2024 13:49:00 -0700 Subject: [PATCH] DOCS: base to_excel docstring template extended for pandas.io.formats.style.Styler.to_excel --- pandas/core/generic.py | 6 +++++- pandas/io/formats/style.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 61fa5c49a8c5b..eae3249aa79a4 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2123,11 +2123,13 @@ def _repr_data_resource_(self): klass="object", storage_options=_shared_docs["storage_options"], storage_options_versionadded="1.2.0", + encoding_parameter="", + verbose_parameter="", extra_parameters=textwrap.dedent( """\ engine_kwargs : dict, optional Arbitrary keyword arguments passed to excel engine. - """ + """ ), ) def to_excel( @@ -2196,9 +2198,11 @@ def to_excel( merge_cells : bool, default True Write MultiIndex and Hierarchical Rows as merged cells. + {encoding_parameter} inf_rep : str, default 'inf' Representation for infinity (there is no native representation for infinity in Excel). + {verbose_parameter} freeze_panes : tuple of int (length 2), optional Specifies the one-based bottommost row and rightmost column that is to be frozen. diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index ae2fba4f7269b..82bc0301fed3a 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -553,14 +553,19 @@ def set_tooltips( klass="Styler", storage_options=_shared_docs["storage_options"], storage_options_versionadded="1.5.0", - extra_parameters=textwrap.dedent( + encoding_parameter=textwrap.dedent( """\ encoding : str or None, default None Unused parameter, present for compatibility. + """ + ), + verbose_parameter=textwrap.dedent( + """\ verbose : str, default True Optional unused parameter, present for compatibility. """ ), + extra_parameters="", ) def to_excel( self, @@ -576,11 +581,11 @@ def to_excel( startcol: int = 0, engine: str | None = None, merge_cells: ExcelWriterMergeCells = True, + encoding: str | None = None, inf_rep: str = "inf", + verbose: bool = True, freeze_panes: tuple[int, int] | None = None, storage_options: StorageOptions | None = None, - encoding: str | None = None, - verbose: bool = True, ) -> None: from pandas.io.formats.excel import ExcelFormatter