【发布时间】:2016-08-09 09:20:58
【问题描述】:
我有这样的 Python 代码:
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return np.int(x)
x = np.arange(1, 15.1, 0.1)
plt.plot(x, f(x))
plt.show()
还有这样的错误:
TypeError: only length-1 arrays can be converted to Python scalars
我该如何解决?
【问题讨论】: