matplotlib错误:TypeError: unsupported operand type(s) for -: 'str' and 'str'

line_chart.add('收盘价', closes)

在加入Y轴元素时, 必须确保加入的数组closes中的元素不是字符串类型,否则就会出现标题中的报错。

添加数组中的元素时改成这样 closes.append(int(float(data['close'])))  能将数组元素变为整型
 

猜你喜欢

转载自blog.csdn.net/qq_38765321/article/details/81172828