🍾 Xarray is now 10 years old! 🎉

xarray.CFTimeIndex.get_indexer_for

xarray.CFTimeIndex.get_indexer_for#

CFTimeIndex.get_indexer_for(target)[source]#

Guaranteed return of an indexer even when non-unique.

This dispatches to get_indexer or get_indexer_non_unique as appropriate.

Returns:

np.ndarray[np.intp] – List of indices.

Examples

>>> idx = pd.Index([np.nan, 'var1', np.nan])
>>> idx.get_indexer_for([np.nan])
array([0, 2])