Sunday, June 14, 2026
HomeLanguagesPython | Numpy np.as_series() method

Python | Numpy np.as_series() method

With the help of np.as_series() method, we can get a 1-D series from multidimensional array by using np.as_series() method.

Syntax : np.as_series(array)
Return : Return a 1-D series.

Example #1 :
In this example we can see that by using np.as_series() method, we are able to get the 1-D series from multidimensional array by using this method.




# import numpy and as_series
import numpy as np
from numpy.polynomial import polyutils as pu
  
arr = np.array([0.1, 0.2, 0.3])
  
# using np.as_series() method
gfg = pu.as_series(arr)
  
print(gfg)


Output :

[array([0.1]), array([0.2]), array([0.3])]

Example #2 :




# import numpy and as_series
import numpy as np
from numpy.polynomial import polyutils as pu
  
arr = np.array([[0.1, 0.2, 0.3], [1, 2, 3]])
  
# using np.as_series() method
gfg = pu.as_series(arr)
  
print(gfg)


Output :

[array([0.1, 0.2, 0.3]), array([1., 2., 3.])]

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS