MCPcopy Index your code
hub / github.com/pydata/xarray / squeeze

Method squeeze

xarray/core/variable.py:1143–1164  ·  view source on GitHub ↗

Return a new object with squeezed data. Parameters ---------- dim : None 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,

(self, dim=None)

Source from the content-addressed store, hash-verified

1141 return self[key]
1142
1143 def squeeze(self, dim=None):
1144 """Return a new object with squeezed data.
1145
1146 Parameters
1147 ----------
1148 dim : None or str or tuple of str, optional
1149 Selects a subset of the length one dimensions. If a dimension is
1150 selected with length greater than one, an error is raised. If
1151 None, all length one dimensions are squeezed.
1152
1153 Returns
1154 -------
1155 squeezed : same type as caller
1156 This object, but with with all or a subset of the dimensions of
1157 length 1 removed.
1158
1159 See Also
1160 --------
1161 numpy.squeeze
1162 """
1163 dims = common.get_squeeze_dims(self, dim)
1164 return self.isel(dict.fromkeys(dims, 0))
1165
1166 def _shift_one_dim(self, dim, count, fill_value=dtypes.NA):
1167 axis = self.get_axis_num(dim)

Callers 15

test_squeezeMethod · 0.95
test_squeezeMethod · 0.95
factorizeMethod · 0.45
plotFunction · 0.45
interpMethod · 0.45
quantileMethod · 0.45
__getitem__Method · 0.45
to_unstacked_datasetMethod · 0.45
_getitemMethod · 0.45
_weighted_quantileMethod · 0.45
polyfitFunction · 0.45

Calls 1

iselMethod · 0.95

Tested by 15

test_squeezeMethod · 0.76
test_squeezeMethod · 0.76
test_squeezeMethod · 0.36
test_expand_dims_intMethod · 0.36
test_squeezeMethod · 0.36
test_squeeze_dropMethod · 0.36
test_isel_fancyMethod · 0.36