method
matrix.squeeze(self, axis=None)
[source]
Return a possibly reshaped matrix.
Refer to numpy.squeeze
for more documentation.
Parameters: |
|
---|---|
Returns: |
|
See also
numpy.squeeze
If m
has a single column then that column is returned as the single row of a matrix. Otherwise m
is returned. The returned matrix is always either m
itself or a view into m
. Supplying an axis keyword argument will not affect the returned matrix but it may cause an error to be raised.
>>> 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]])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.matrix.squeeze.html