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

bundles / numpy latest / numpy / polynomial / polyutils / as_series

function

numpy.polynomial.polyutils:as_series

source: build-install/usr/lib/python3.14/site-packages/numpy/polynomial/polyutils.py :63

Signature

def   as_series ( alist trim = True )

Summary

Return argument as a list of 1-d arrays.

Extended Summary

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

alist : array_like

A 1- or 2-d array_like

trim : boolean, optional

When True, trailing zeros are removed from the inputs. When False, the inputs are passed through intact.

Returns

[a1, a2,...] : list of 1-D arrays

A copy of the input data as a list of 1-d arrays.

Raises

: ValueError

Raised when as_series cannot convert its input to 1-d arrays, or at least one of the resulting arrays is empty.

Examples

import numpy as np
from numpy.polynomial import polyutils as pu
a = np.arange(4)
pu.as_series(a)
b = np.arange(6).reshape((2,3))
pu.as_series(b)
pu.as_series((1, np.arange(3), np.arange(2, dtype=np.float16)))
pu.as_series([2, [1.1, 0.]])
pu.as_series([2, [1.1, 0.]], trim=False)

Aliases

  • numpy.polynomial.polyutils.as_series