numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
squeeze(self, axis=None)

Refer to numpy.squeeze for more documentation.

Notes

If :None:None:`m` has a single column then that column is returned as the single row of a matrix. Otherwise :None:None:`m` is returned. The returned matrix is always either :None:None:`m` itself or a view into :None:None:`m`. Supplying an axis keyword argument will not affect the returned matrix but it may cause an error to be raised.

Parameters

axis : None or int or tuple of ints, optional

Selects a subset of the axes of length one in the shape. If an axis is selected with shape entry greater than one, an error is raised.

Returns

squeezed : matrix

The matrix, but as a (1, N) matrix if it had shape (N, 1).

Return a possibly reshaped matrix.

See Also

numpy.squeeze

related function

Examples

>>> c = np.matrix([[1], [2]])
... c matrix([[1], [2]])
>>> c.squeeze()
matrix([[1, 2]])
>>> r = c.T
... r matrix([[1, 2]])
>>> r.squeeze()
matrix([[1, 2]])
>>> m = np.matrix([[1, 2], [3, 4]])
... m.squeeze() matrix([[1, 2], [3, 4]])
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/matrixlib/defmatrix.py#323
type: <class 'function'>
Commit: