TypeError:在绘图时,只有length-1数组可以转换… 投稿者 5 年前 我有这样的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 我该如何解决? 百度未收录 退出移动版
我有这样的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 我该如何解决? 百度未收录