numpy.polynomial.polyutils.as_series(alist, trim=True)
[source]
Return argument as a list of 1-d arrays.
The returned list contains array(s) of dtype double, complex double, or object. A 1-d argument of shape (N,)
is parsed into N
arrays of size one; a 2-d argument of shape (M,N)
is parsed into M
arrays of size N
(i.e., is “parsed by row”); and a higher dimensional array raises a Value Error if it is not first reshaped into either a 1-d or 2-d array.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
>>> from numpy.polynomial import polyutils as pu >>> a = np.arange(4) >>> pu.as_series(a) [array([0.]), array([1.]), array([2.]), array([3.])] >>> b = np.arange(6).reshape((2,3)) >>> pu.as_series(b) [array([0., 1., 2.]), array([3., 4., 5.])]
>>> pu.as_series((1, np.arange(3), np.arange(2, dtype=np.float16))) [array([1.]), array([0., 1., 2.]), array([0., 1.])]
>>> pu.as_series([2, [1.1, 0.]]) [array([2.]), array([1.1])]
>>> pu.as_series([2, [1.1, 0.]], trim=False) [array([2.]), array([1.1, 0. ])]
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.polynomial.polyutils.as_series.html