Open In App

Python | Numpy np.lagone() method

Last Updated : 29 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

np.lagone() method can be used instead of np.ones for creating a array whose elements are 1.

Syntax : np.lagone()
Return : Return array([1])

Example #1 :




    
# Python program explaining
# numpy.lagone() method 
  
# import numpy and lagone
import numpy as np
from numpy.polynomial.laguerre import lagone
  
# using np.lagone() method
ans = lagone
  
print(ans)


Output :

[1]

Example #2 :




# Python program explaining
# numpy.lagone() method 
  
# import numpy and lagone
import numpy as np
from numpy.polynomial.laguerre  import lagone
  
# using np.lagone() method
ans = lagone + [[1, 3, 5], [2, 4, 6]]
  
print(ans)


Output :

[[2 4 6]
[3 5 7]]


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads