Skip to content

replaced one occurrence of Appender by doc decorator #32787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,9 +1915,9 @@ def _repr_data_resource_(self):
_shared_docs[
"to_excel"
] = """
Write %(klass)s to an Excel sheet.
Write {klass} to an Excel sheet.

To write a single %(klass)s to an Excel .xlsx file it is only necessary to
To write a single {klass} to an Excel .xlsx file it is only necessary to
specify a target file name. To write to multiple sheets it is necessary to
create an `ExcelWriter` object with a target file name, and specify a sheet
in the file to write to.
Expand All @@ -1937,7 +1937,7 @@ def _repr_data_resource_(self):
Missing data representation.
float_format : str, optional
Format string for floating point numbers. For example
``float_format="%%.2f"`` will format 0.1234 to 0.12.
``float_format="%.2f"`` will format 0.1234 to 0.12.
columns : sequence or list of str, optional
Columns to write.
header : bool or list of str, default True
Expand Down Expand Up @@ -2022,7 +2022,7 @@ def _repr_data_resource_(self):
>>> df1.to_excel('output1.xlsx', engine='xlsxwriter') # doctest: +SKIP
"""

@Appender(_shared_docs["to_excel"] % dict(klass="object"))
@doc(_shared_docs["to_excel"], klass="object")
def to_excel(
self,
excel_writer,
Expand Down
18 changes: 8 additions & 10 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from pandas._libs import lib
from pandas._typing import Axis, FrameOrSeries, FrameOrSeriesUnion, Label
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import Appender
from pandas.util._decorators import doc

from pandas.core.dtypes.common import is_float

Expand Down Expand Up @@ -192,17 +192,15 @@ def _repr_html_(self) -> str:
"""
return self.render()

@Appender(
_shared_docs["to_excel"]
% dict(
axes="index, columns",
klass="Styler",
axes_single_arg="{0 or 'index', 1 or 'columns'}",
optional_by="""
@doc(
_shared_docs["to_excel"],
axes="index, columns",
klass="Styler",
axes_single_arg="{0 or 'index', 1 or 'columns'}",
optional_by="""
by : str or list of str
Name or list of names which refer to the axis items.""",
versionadded_to_excel="\n .. versionadded:: 0.20",
)
versionadded_to_excel="\n .. versionadded:: 0.20",
)
def to_excel(
self,
Expand Down