@@ -3963,13 +3963,56 @@ def reindex(
3963
3963
Parameters
3964
3964
----------
3965
3965
target : an iterable
3966
+ method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
3967
+ * default: exact matches only.
3968
+ * pad / ffill: find the PREVIOUS index value if no exact match.
3969
+ * backfill / bfill: use NEXT index value if no exact match
3970
+ * nearest: use the NEAREST index value if no exact match. Tied
3971
+ distances are broken by preferring the larger index value.
3972
+ level : int, optional
3973
+ Level of multiindex.
3974
+ limit : int, optional
3975
+ Maximum number of consecutive labels in ``target`` to match for
3976
+ inexact matches.
3977
+ tolerance : int or float, optional
3978
+ Maximum distance between original and new labels for inexact
3979
+ matches. The values of the index at the matching locations must
3980
+ satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
3981
+
3982
+ Tolerance may be a scalar value, which applies the same tolerance
3983
+ to all values, or list-like, which applies variable tolerance per
3984
+ element. List-like includes list, tuple, array, Series, and must be
3985
+ the same size as the index and its dtype must exactly match the
3986
+ index's type.
3966
3987
3967
3988
Returns
3968
3989
-------
3969
3990
new_index : pd.Index
3970
3991
Resulting index.
3971
3992
indexer : np.ndarray[np.intp] or None
3972
3993
Indices of output values in original index.
3994
+
3995
+ Raises
3996
+ ------
3997
+ TypeError
3998
+ If ``method`` passed along with ``level``.
3999
+ ValueError
4000
+ If non-unique multi-index
4001
+ ValueError
4002
+ If non-unique index and ``method`` or ``limit`` passed.
4003
+
4004
+ See Also
4005
+ --------
4006
+ Series.reindex
4007
+ DataFrame.reindex
4008
+
4009
+ Examples
4010
+ --------
4011
+ >>> idx = pd.Index(['car', 'bike', 'train', 'tractor'])
4012
+ >>> idx
4013
+ Index(['car', 'bike', 'train', 'tractor'], dtype='object')
4014
+ >>> idx.reindex(['car', 'bike'])
4015
+ (Index(['car', 'bike'], dtype='object'), array([0, 1]))
3973
4016
"""
3974
4017
# GH6552: preserve names when reindexing to non-named target
3975
4018
# (i.e. neither Index nor Series).
0 commit comments