Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.atleast_1d

numpy.atleast_1d(*arys)[source]

Convert inputs to arrays with at least one dimension.

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

Parameters:

arys1, arys2, ... : array_like

One or more input arrays.

Returns:

ret : ndarray

An array, or list of arrays, each witha.ndim>=1.Copies are made only if necessary.

Examples

>>>np.atleast_1d(1.0)array([ 1.])
>>>x=np.arange(9.0).reshape(3,3)>>>np.atleast_1d(x)array([[ 0.,  1.,  2.],       [ 3.,  4.,  5.],       [ 6.,  7.,  8.]])>>>np.atleast_1d(x)isxTrue
>>>np.atleast_1d(1,[3,4])[array([1]), array([3, 4])]

Previous topic

numpy.transpose

Next topic

numpy.atleast_2d

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp