xarray.Dataset.squeeze

Dataset.squeeze(dim=None, drop=False, axis=None)

Return a new object with squeezed data.

Parameters
dimNone or str or tuple of str, 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.

dropbool, optional

If drop=True, drop squeezed coordinates instead of making them scalar.

axisint, optional

Select the dimension to squeeze. Added for compatibility reasons.

Returns
squeezedsame type as caller

This object, but with with all or a subset of the dimensions of length 1 removed.

See also

numpy.squeeze