xarray.DataArray.sel¶
-
DataArray.
sel
(indexers=None, method=None, tolerance=None, drop=False, **indexers_kwargs)¶ Return a new DataArray whose dataset is given by selecting index labels along the specified dimension(s).
Warning
Do not try to assign values when using any of the indexing methods
isel
orsel
:da = xr.DataArray([0, 1, 2, 3], dims=['x']) # DO NOT do this da.isel(x=[0, 1, 2])[1] = -1
Assigning values with the chained indexing using
.sel
or.isel
fails silently.See also