cf.Data.squeeze¶
-
Data.
squeeze
(axes=None, i=False)[source]¶ Remove size 1 axes from the data array.
By default all size 1 axes are removed, but particular axes may be selected with the keyword arguments.
See also
Parameters: - axes : (sequence of) int or str, optional
Select the axes. By default all size 1 axes are removed. The axes argument may be one, or a sequence, of:
- An internal axis identifier. Selects this axis.
- An integer. Selects the axis coresponding to the given position in the list of axes of the data array.
No axes are removed if axes is an empty sequence.
- i : bool, optional
If True then update the data array in place. By default a new data array is created.
Returns: - out : cf.Data
The squeezed data array.
Examples: >>> v.shape (1,) >>> v.squeeze() >>> v.shape ()
>>> v.shape (1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1) >>> v.squeeze((0,)) >>> v.shape (2, 1, 3, 1, 4, 1, 5, 1, 6, 1) >>> v.squeeze(1) >>> v.shape (2, 3, 1, 4, 1, 5, 1, 6, 1) >>> v.squeeze([2, 4]) >>> v.shape (2, 3, 4, 5, 1, 6, 1) >>> v.squeeze([]) >>> v.shape (2, 3, 4, 5, 1, 6, 1) >>> v.squeeze() >>> v.shape (2, 3, 4, 5, 6)