Thursday, October 2, 2025
HomeLanguagesPython | Numpy np.lagone() method

Python | Numpy np.lagone() method

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]]

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

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11867 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11927 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7080 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS