49
49
from pandas .compat .numpy import function as nv
50
50
from pandas .errors import AbstractMethodError , InvalidIndexError
51
51
from pandas .util ._decorators import (
52
- Appender ,
53
- Substitution ,
54
52
doc ,
55
53
rewrite_axis_style_signature ,
56
54
)
@@ -6797,6 +6795,22 @@ def interpolate(
6797
6795
3 16.0
6798
6796
Name: d, dtype: float64
6799
6797
"""
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
+ """
6800
6814
inplace = validate_bool_kwarg (inplace , "inplace" )
6801
6815
6802
6816
axis = self ._get_axis_number (axis )
@@ -10661,29 +10675,29 @@ def _doc_parms(cls):
10661
10675
10662
10676
10663
10677
_num_doc = """
10664
- %( desc)s
10678
+ { desc}
10665
10679
10666
10680
Parameters
10667
10681
----------
10668
- axis : %( axis_descr)s
10682
+ axis : { axis_descr}
10669
10683
Axis for the function to be applied on.
10670
10684
skipna : bool, default True
10671
10685
Exclude NA/null values when computing the result.
10672
10686
level : int or level name, default None
10673
10687
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} .
10675
10689
numeric_only : bool, default None
10676
10690
Include only float, int, boolean columns. If None, will attempt to use
10677
10691
everything, then use only numeric data. Not implemented for Series.
10678
- %( min_count)s \
10692
+ { min_count} \
10679
10693
**kwargs
10680
10694
Additional keyword arguments to be passed to the function.
10681
10695
10682
10696
Returns
10683
10697
-------
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}
10687
10701
"""
10688
10702
10689
10703
_num_ddof_doc = """
@@ -10710,11 +10724,11 @@ def _doc_parms(cls):
10710
10724
{name1} or {name2} (if level specified)\n """
10711
10725
10712
10726
_bool_doc = """
10713
- %( desc)s
10727
+ { desc}
10714
10728
10715
10729
Parameters
10716
10730
----------
10717
- axis : {0 or 'index', 1 or 'columns', None}, default 0
10731
+ axis : {{ 0 or 'index', 1 or 'columns', None} }, default 0
10718
10732
Indicate which axis or axes should be reduced.
10719
10733
10720
10734
* 0 / 'index' : reduce the index, return a Series whose index is the
@@ -10728,24 +10742,24 @@ def _doc_parms(cls):
10728
10742
then use only boolean data. Not implemented for Series.
10729
10743
skipna : bool, default True
10730
10744
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.
10732
10746
If skipna is False, then NA are treated as True, because these are not
10733
10747
equal to zero.
10734
10748
level : int or level name, default None
10735
10749
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} .
10737
10751
**kwargs : any, default None
10738
10752
Additional keywords have no effect but might be accepted for
10739
10753
compatibility with NumPy.
10740
10754
10741
10755
Returns
10742
10756
-------
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}
10745
10759
is returned.
10746
10760
10747
- %( see_also)s
10748
- %( examples)s """
10761
+ { see_also}
10762
+ { examples} """
10749
10763
10750
10764
_all_desc = """\
10751
10765
Return whether all elements are True, potentially over an axis.
@@ -10808,14 +10822,14 @@ def _doc_parms(cls):
10808
10822
"""
10809
10823
10810
10824
_cnum_doc = """
10811
- Return cumulative %( desc)s over a DataFrame or Series axis.
10825
+ Return cumulative { desc} over a DataFrame or Series axis.
10812
10826
10813
10827
Returns a DataFrame or Series of the same size containing the cumulative
10814
- %( desc)s .
10828
+ { desc} .
10815
10829
10816
10830
Parameters
10817
10831
----------
10818
- axis : {0 or 'index', 1 or 'columns'}, default 0
10832
+ axis : {{ 0 or 'index', 1 or 'columns'} }, default 0
10819
10833
The index or the name of the axis. 0 is equivalent to None or 'index'.
10820
10834
skipna : bool, default True
10821
10835
Exclude NA/null values. If an entire row/column is NA, the result
@@ -10826,21 +10840,21 @@ def _doc_parms(cls):
10826
10840
10827
10841
Returns
10828
10842
-------
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} .
10831
10845
10832
10846
See Also
10833
10847
--------
10834
- core.window.Expanding.%( accum_func_name)s : Similar functionality
10848
+ core.window.Expanding.{ accum_func_name} : Similar functionality
10835
10849
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.
10842
10856
10843
- %( examples)s """
10857
+ { examples} """
10844
10858
10845
10859
_cummin_examples = """\
10846
10860
Examples
@@ -11321,7 +11335,8 @@ def _make_min_count_stat_function(
11321
11335
see_also : str = "" ,
11322
11336
examples : str = "" ,
11323
11337
) -> Callable :
11324
- @Substitution (
11338
+ @doc (
11339
+ _num_doc ,
11325
11340
desc = desc ,
11326
11341
name1 = name1 ,
11327
11342
name2 = name2 ,
@@ -11330,7 +11345,6 @@ def _make_min_count_stat_function(
11330
11345
see_also = see_also ,
11331
11346
examples = examples ,
11332
11347
)
11333
- @Appender (_num_doc )
11334
11348
def stat_func (
11335
11349
self ,
11336
11350
axis = None ,
@@ -11377,7 +11391,8 @@ def _make_stat_function(
11377
11391
see_also : str = "" ,
11378
11392
examples : str = "" ,
11379
11393
) -> Callable :
11380
- @Substitution (
11394
+ @doc (
11395
+ _num_doc ,
11381
11396
desc = desc ,
11382
11397
name1 = name1 ,
11383
11398
name2 = name2 ,
@@ -11386,7 +11401,6 @@ def _make_stat_function(
11386
11401
see_also = see_also ,
11387
11402
examples = examples ,
11388
11403
)
11389
- @Appender (_num_doc )
11390
11404
def stat_func (
11391
11405
self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs
11392
11406
):
@@ -11441,15 +11455,15 @@ def _make_cum_function(
11441
11455
accum_func_name : str ,
11442
11456
examples : str ,
11443
11457
) -> Callable :
11444
- @Substitution (
11458
+ @doc (
11459
+ _cnum_doc ,
11445
11460
desc = desc ,
11446
11461
name1 = name1 ,
11447
11462
name2 = name2 ,
11448
11463
axis_descr = axis_descr ,
11449
11464
accum_func_name = accum_func_name ,
11450
11465
examples = examples ,
11451
11466
)
11452
- @Appender (_cnum_doc )
11453
11467
def cum_func (self , axis = None , skipna = True , * args , ** kwargs ):
11454
11468
skipna = nv .validate_cum_func_with_skipna (skipna , args , kwargs , name )
11455
11469
if axis is None :
@@ -11487,7 +11501,8 @@ def _make_logical_function(
11487
11501
examples : str ,
11488
11502
empty_value : bool ,
11489
11503
) -> Callable :
11490
- @Substitution (
11504
+ @doc (
11505
+ _bool_doc ,
11491
11506
desc = desc ,
11492
11507
name1 = name1 ,
11493
11508
name2 = name2 ,
@@ -11496,7 +11511,6 @@ def _make_logical_function(
11496
11511
examples = examples ,
11497
11512
empty_value = empty_value ,
11498
11513
)
11499
- @Appender (_bool_doc )
11500
11514
def logical_func (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
11501
11515
nv .validate_logical_func (tuple (), kwargs , fname = name )
11502
11516
if level is not None :
0 commit comments