cf.Data.squeeze¶
-
Data.
squeeze
(axes=None, inplace=False, 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, optional
Select the axes. By default all size 1 axes are removed. The axes argument may be one, or a sequence, of integers that select 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.
- inplace:
bool
, optional If True then do the operation in-place and return
None
.- i: deprecated at version 3.0.0
Use inplace parameter instead.
Returns: 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)