📜  Python| Numpy np.polyone() 方法

📅  最后修改于: 2022-05-13 01:55:50.105000             🧑  作者: Mango

Python| Numpy np.polyone() 方法

可以使用np.polyone()方法代替np.ones来创建元素为 1 的数组。

示例 #1:

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

输出 :

示例 #2:

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

输出 :