bundles / numpy 2.4.3 / numpy / ma / extras / atleast_2d
function
numpy.ma.extras:atleast_2d
source: /numpy/_core/shape_base.py :78
Signature
def atleast_2d ( * arys ) Summary
View inputs as arrays with at least two dimensions.
Parameters
arys1, arys2, ...: array_likeOne or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
Returns
res, res2, ...: ndarrayAn array, or tuple of arrays, each with
a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.
Notes
The function is applied to both the _data and the _mask, if any.
Examples
import numpy as np np.atleast_2d(3.0)✓
x = np.arange(3.0) np.atleast_2d(x) np.atleast_2d(x).base is x✓
np.atleast_2d(1, [1, 2], [[1, 2]])
✓See also
Aliases
-
numpy.ma.atleast_2d