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.

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

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



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

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

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.