【发布时间】:2020-04-30 15:57:25
【问题描述】:
TypeError:只有 size-1 的数组可以转换为 Python 标量
import math
import numpy as np
import matplotlib.pyplot as plt
def myfunction(x):
return np.int(x)
myfunction2 = np.vectorize(myfunction)
x = np.array([0, math.pi/100, 2*math.pi])
y = math.sin(x)
plt.plot(myfunction2(x),y)
plt.show()
【问题讨论】:
标签: python