🍾 Xarray is now 10 years old! 🎉

xarray.Index.isel

Contents

xarray.Index.isel#

Index.isel(indexers)[source]#

Maybe returns a new index from the current index itself indexed by positional indexers.

This method should be re-implemented in subclasses of Index if the wrapped index structure supports indexing operations. For example, indexing a pandas.Index is pretty straightforward as it behaves very much like an array. By contrast, it may be harder doing so for a structure like a kd-tree that differs much from a simple array.

If not re-implemented in subclasses of Index, this method returns None, i.e., calling Dataset.isel() will either drop the index in the resulting dataset or pass it unchanged if its corresponding coordinate(s) are not indexed.

Parameters:

indexers (dict) – A dictionary of positional indexers as passed from Dataset.isel() and where the entries have been filtered for the current index.

Returns:

maybe_index (Index) – A new Index object or None.