@@ -3348,34 +3348,45 @@ def get_loc(self, key, method=None, tolerance=None):
3348
3348
return loc
3349
3349
3350
3350
_index_shared_docs [
3351
- "get_indexer "
3351
+ "method "
3352
3352
] = """
3353
- Compute indexer and mask for new index given the current index. The
3354
- indexer should be then used as an input to ndarray.take to align the
3355
- current data to the new index.
3356
-
3357
- Parameters
3358
- ----------
3359
- target : %(target_klass)s
3360
- method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
3353
+ {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
3361
3354
* default: exact matches only.
3362
3355
* pad / ffill: find the PREVIOUS index value if no exact match.
3363
3356
* backfill / bfill: use NEXT index value if no exact match
3364
3357
* nearest: use the NEAREST index value if no exact match. Tied
3365
3358
distances are broken by preferring the larger index value.
3366
- limit : int, optional
3359
+ """
3360
+ _index_shared_docs [
3361
+ "limit"
3362
+ ] = """
3363
+ int, optional
3367
3364
Maximum number of consecutive labels in ``target`` to match for
3368
3365
inexact matches.
3369
- tolerance : optional
3366
+ """
3367
+
3368
+ _index_shared_docs [
3369
+ "tolerance"
3370
+ ] = """
3371
+ optional
3370
3372
Maximum distance between original and new labels for inexact
3371
3373
matches. The values of the index at the matching locations must
3372
3374
satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
3375
+ """
3373
3376
3374
- Tolerance may be a scalar value, which applies the same tolerance
3375
- to all values, or list-like, which applies variable tolerance per
3376
- element. List-like includes list, tuple, array, Series, and must be
3377
- the same size as the index and its dtype must exactly match the
3378
- index's type.
3377
+ _index_shared_docs [
3378
+ "get_indexer"
3379
+ ] = """
3380
+ Compute indexer and mask for new index given the current index. The
3381
+ indexer should be then used as an input to ndarray.take to align the
3382
+ current data to the new index.
3383
+
3384
+ Parameters
3385
+ ----------
3386
+ target : %(target_klass)s
3387
+ method : %(method)s
3388
+ limit : %(limit)s
3389
+ tolerance : %(tolerance)s
3379
3390
3380
3391
Returns
3381
3392
-------
@@ -3761,34 +3772,20 @@ def _validate_can_reindex(self, indexer: np.ndarray) -> None:
3761
3772
if not self ._index_as_unique and len (indexer ):
3762
3773
raise ValueError ("cannot reindex from a duplicate axis" )
3763
3774
3764
- def reindex (self , target , method = None , level = None , limit = None , tolerance = None ):
3765
- """
3775
+ _index_shared_docs [
3776
+ "reindex"
3777
+ ] = """
3766
3778
Create an index with target's values.
3767
3779
3768
3780
Parameters
3769
3781
----------
3770
3782
target : an iterable
3771
- method : {None, ‘backfill’/’bfill’, ‘pad’/’ffill’, ‘nearest’}
3772
- Method to use for filling holes in reindexed DataFrame.
3773
- Please note: this is only applicable to DataFrames/Series
3774
- with a monotonically increasing/decreasing index.
3775
- - None (default): don’t fill gaps
3776
- - pad / ffill: Propagate last valid observation forward to next valid.
3777
- - backfill / bfill: Use next valid observation to fill gap.
3778
- - nearest: Use nearest valid observations to fill gap.
3783
+ method : %(method)s
3779
3784
level : int or name
3780
3785
Broadcast across a level, matching Index values on
3781
3786
the passed MultiIndex level.
3782
- limit : int, default None
3783
- Maximum number of consecutive elements to forward or backward fill.
3784
- tolerance : optional
3785
- Maximum distance between original and new labels for inexact matches.
3786
- The values of the index at the matching locations most satisfy the
3787
- equation `abs(index[indexer] - target) <= tolerance`.
3788
- Tolerance may be a scalar value, which applies the same tolerance
3789
- to all values, or list-like, which applies variable tolerance per element.
3790
- List-like includes list, tuple, array, Series, and must be the same size
3791
- as the index and its dtype must exactly match the index’s type.
3787
+ limit : %(limit)s
3788
+ tolerance : %(tolerance)
3792
3789
3793
3790
Returns
3794
3791
-------
@@ -3817,6 +3814,10 @@ def reindex(self, target, method=None, level=None, limit=None, tolerance=None):
3817
3814
>>> target, indexer
3818
3815
(Index(['I', 'd', 'III', 'IV'], dtype='object'), array([-1, 3, 0, -1]))
3819
3816
"""
3817
+
3818
+ @Appender (_index_shared_docs ["reindex" ] % _index_doc_kwargs )
3819
+ @final
3820
+ def reindex (self , target , method = None , level = None , limit = None , tolerance = None ):
3820
3821
# GH6552: preserve names when reindexing to non-named target
3821
3822
# (i.e. neither Index nor Series).
3822
3823
preserve_names = not hasattr (target , "name" )
0 commit comments