pandas.Index.get_indexer¶
- Index.get_indexer(target, method=None, limit=None)¶
Compute indexer and mask for new index given the current index. The indexer should be then used as an input to ndarray.take to align the current data to the new index. The mask determines whether labels are found or not in the current index
Parameters: target : Index
method : {‘pad’, ‘ffill’, ‘backfill’, ‘bfill’}
pad / ffill: propagate LAST valid observation forward to next valid backfill / bfill: use NEXT valid observation to fill gap
Returns: indexer : ndarray
Notes
This is a low-level method and probably should be used at your own risk
Examples
>>> indexer = index.get_indexer(new_index) >>> new_values = cur_values.take(indexer)