This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / extras / atleast_1d

function

numpy.ma.extras:atleast_1d

source: build-install/usr/lib/python3.14/site-packages/numpy/_core/shape_base.py :19

Signature

def   atleast_1d ( * arys )

Summary

Convert inputs to arrays with at least one dimension.

Extended Summary

Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.

Parameters

arys1, arys2, ... : array_like

One or more input arrays.

Returns

ret : ndarray

An array, or tuple of arrays, each with a.ndim >= 1. Copies are made only if necessary.

Notes

The function is applied to both the _data and the _mask, if any.

Examples

import numpy as np
np.atleast_1d(1.0)
x = np.arange(9.0).reshape(3,3)
np.atleast_1d(x)
np.atleast_1d(x) is x
np.atleast_1d(1, [3, 4])

See also

atleast_2d
atleast_3d

Aliases

  • numpy.ma.atleast_1d