xarray.DataArray.squeeze¶
-
DataArray.
squeeze
(dim=None, drop=False, axis=None)[source]¶ Return a new object with squeezed data.
- Parameters
dim (
None
orHashable
or iterable ofHashable
, optional) – Selects a subset of the length one dimensions. If a dimension is selected with length greater than one, an error is raised. If None, all length one dimensions are squeezed.drop (
bool
, optional) – Ifdrop=True
, drop squeezed coordinates instead of making them scalar.axis (
None
orint
or iterable ofint
, optional) – Like dim, but positional.
- Returns
squeezed (
same type as caller
) – This object, but with with all or a subset of the dimensions of length 1 removed.
See also