Skip to content

Commit 8f33cdc

Browse files
committed
replaced the remaining occurrences of Appender in generic.py
1 parent e966fcb commit 8f33cdc

File tree

1 file changed

+52
-38
lines changed

1 file changed

+52
-38
lines changed

pandas/core/generic.py

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
from pandas.compat.numpy import function as nv
5050
from pandas.errors import AbstractMethodError, InvalidIndexError
5151
from pandas.util._decorators import (
52-
Appender,
53-
Substitution,
5452
doc,
5553
rewrite_axis_style_signature,
5654
)
@@ -6797,6 +6795,22 @@ def interpolate(
67976795
3 16.0
67986796
Name: d, dtype: float64
67996797
"""
6798+
6799+
@doc(_shared_docs["interpolate"], **_shared_doc_kwargs)
6800+
def interpolate(
6801+
self,
6802+
method="linear",
6803+
axis=0,
6804+
limit=None,
6805+
inplace=False,
6806+
limit_direction="forward",
6807+
limit_area=None,
6808+
downcast=None,
6809+
**kwargs,
6810+
):
6811+
"""
6812+
Interpolate values according to different methods.
6813+
"""
68006814
inplace = validate_bool_kwarg(inplace, "inplace")
68016815

68026816
axis = self._get_axis_number(axis)
@@ -10661,29 +10675,29 @@ def _doc_parms(cls):
1066110675

1066210676

1066310677
_num_doc = """
10664-
%(desc)s
10678+
{desc}
1066510679
1066610680
Parameters
1066710681
----------
10668-
axis : %(axis_descr)s
10682+
axis : {axis_descr}
1066910683
Axis for the function to be applied on.
1067010684
skipna : bool, default True
1067110685
Exclude NA/null values when computing the result.
1067210686
level : int or level name, default None
1067310687
If the axis is a MultiIndex (hierarchical), count along a
10674-
particular level, collapsing into a %(name1)s.
10688+
particular level, collapsing into a {name1}.
1067510689
numeric_only : bool, default None
1067610690
Include only float, int, boolean columns. If None, will attempt to use
1067710691
everything, then use only numeric data. Not implemented for Series.
10678-
%(min_count)s\
10692+
{min_count}\
1067910693
**kwargs
1068010694
Additional keyword arguments to be passed to the function.
1068110695
1068210696
Returns
1068310697
-------
10684-
%(name1)s or %(name2)s (if level specified)\
10685-
%(see_also)s\
10686-
%(examples)s
10698+
{name1} or {name2} (if level specified)\
10699+
{see_also}\
10700+
{examples}
1068710701
"""
1068810702

1068910703
_num_ddof_doc = """
@@ -10710,11 +10724,11 @@ def _doc_parms(cls):
1071010724
{name1} or {name2} (if level specified)\n"""
1071110725

1071210726
_bool_doc = """
10713-
%(desc)s
10727+
{desc}
1071410728
1071510729
Parameters
1071610730
----------
10717-
axis : {0 or 'index', 1 or 'columns', None}, default 0
10731+
axis : {{0 or 'index', 1 or 'columns', None}}, default 0
1071810732
Indicate which axis or axes should be reduced.
1071910733
1072010734
* 0 / 'index' : reduce the index, return a Series whose index is the
@@ -10728,24 +10742,24 @@ def _doc_parms(cls):
1072810742
then use only boolean data. Not implemented for Series.
1072910743
skipna : bool, default True
1073010744
Exclude NA/null values. If the entire row/column is NA and skipna is
10731-
True, then the result will be %(empty_value)s, as for an empty row/column.
10745+
True, then the result will be {empty_value}, as for an empty row/column.
1073210746
If skipna is False, then NA are treated as True, because these are not
1073310747
equal to zero.
1073410748
level : int or level name, default None
1073510749
If the axis is a MultiIndex (hierarchical), count along a
10736-
particular level, collapsing into a %(name1)s.
10750+
particular level, collapsing into a {name1}.
1073710751
**kwargs : any, default None
1073810752
Additional keywords have no effect but might be accepted for
1073910753
compatibility with NumPy.
1074010754
1074110755
Returns
1074210756
-------
10743-
%(name1)s or %(name2)s
10744-
If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
10757+
{name1} or {name2}
10758+
If level is specified, then, {name2} is returned; otherwise, {name1}
1074510759
is returned.
1074610760
10747-
%(see_also)s
10748-
%(examples)s"""
10761+
{see_also}
10762+
{examples}"""
1074910763

1075010764
_all_desc = """\
1075110765
Return whether all elements are True, potentially over an axis.
@@ -10808,14 +10822,14 @@ def _doc_parms(cls):
1080810822
"""
1080910823

1081010824
_cnum_doc = """
10811-
Return cumulative %(desc)s over a DataFrame or Series axis.
10825+
Return cumulative {desc} over a DataFrame or Series axis.
1081210826
1081310827
Returns a DataFrame or Series of the same size containing the cumulative
10814-
%(desc)s.
10828+
{desc}.
1081510829
1081610830
Parameters
1081710831
----------
10818-
axis : {0 or 'index', 1 or 'columns'}, default 0
10832+
axis : {{0 or 'index', 1 or 'columns'}}, default 0
1081910833
The index or the name of the axis. 0 is equivalent to None or 'index'.
1082010834
skipna : bool, default True
1082110835
Exclude NA/null values. If an entire row/column is NA, the result
@@ -10826,21 +10840,21 @@ def _doc_parms(cls):
1082610840
1082710841
Returns
1082810842
-------
10829-
%(name1)s or %(name2)s
10830-
Return cumulative %(desc)s of %(name1)s or %(name2)s.
10843+
{name1} or {name2}
10844+
Return cumulative {desc} of {name1} or {name2}.
1083110845
1083210846
See Also
1083310847
--------
10834-
core.window.Expanding.%(accum_func_name)s : Similar functionality
10848+
core.window.Expanding.{accum_func_name} : Similar functionality
1083510849
but ignores ``NaN`` values.
10836-
%(name2)s.%(accum_func_name)s : Return the %(desc)s over
10837-
%(name2)s axis.
10838-
%(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
10839-
%(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
10840-
%(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
10841-
%(name2)s.cumprod : Return cumulative product over %(name2)s axis.
10850+
{name2}.{accum_func_name} : Return the {desc} over
10851+
{name2} axis.
10852+
{name2}.cummax : Return cumulative maximum over {name2} axis.
10853+
{name2}.cummin : Return cumulative minimum over {name2} axis.
10854+
{name2}.cumsum : Return cumulative sum over {name2} axis.
10855+
{name2}.cumprod : Return cumulative product over {name2} axis.
1084210856
10843-
%(examples)s"""
10857+
{examples}"""
1084410858

1084510859
_cummin_examples = """\
1084610860
Examples
@@ -11321,7 +11335,8 @@ def _make_min_count_stat_function(
1132111335
see_also: str = "",
1132211336
examples: str = "",
1132311337
) -> Callable:
11324-
@Substitution(
11338+
@doc(
11339+
_num_doc,
1132511340
desc=desc,
1132611341
name1=name1,
1132711342
name2=name2,
@@ -11330,7 +11345,6 @@ def _make_min_count_stat_function(
1133011345
see_also=see_also,
1133111346
examples=examples,
1133211347
)
11333-
@Appender(_num_doc)
1133411348
def stat_func(
1133511349
self,
1133611350
axis=None,
@@ -11377,7 +11391,8 @@ def _make_stat_function(
1137711391
see_also: str = "",
1137811392
examples: str = "",
1137911393
) -> Callable:
11380-
@Substitution(
11394+
@doc(
11395+
_num_doc,
1138111396
desc=desc,
1138211397
name1=name1,
1138311398
name2=name2,
@@ -11386,7 +11401,6 @@ def _make_stat_function(
1138611401
see_also=see_also,
1138711402
examples=examples,
1138811403
)
11389-
@Appender(_num_doc)
1139011404
def stat_func(
1139111405
self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs
1139211406
):
@@ -11441,15 +11455,15 @@ def _make_cum_function(
1144111455
accum_func_name: str,
1144211456
examples: str,
1144311457
) -> Callable:
11444-
@Substitution(
11458+
@doc(
11459+
_cnum_doc,
1144511460
desc=desc,
1144611461
name1=name1,
1144711462
name2=name2,
1144811463
axis_descr=axis_descr,
1144911464
accum_func_name=accum_func_name,
1145011465
examples=examples,
1145111466
)
11452-
@Appender(_cnum_doc)
1145311467
def cum_func(self, axis=None, skipna=True, *args, **kwargs):
1145411468
skipna = nv.validate_cum_func_with_skipna(skipna, args, kwargs, name)
1145511469
if axis is None:
@@ -11487,7 +11501,8 @@ def _make_logical_function(
1148711501
examples: str,
1148811502
empty_value: bool,
1148911503
) -> Callable:
11490-
@Substitution(
11504+
@doc(
11505+
_bool_doc,
1149111506
desc=desc,
1149211507
name1=name1,
1149311508
name2=name2,
@@ -11496,7 +11511,6 @@ def _make_logical_function(
1149611511
examples=examples,
1149711512
empty_value=empty_value,
1149811513
)
11499-
@Appender(_bool_doc)
1150011514
def logical_func(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
1150111515
nv.validate_logical_func(tuple(), kwargs, fname=name)
1150211516
if level is not None:

0 commit comments

Comments
 (0)