当前位置: 代码迷 >> 综合 >> matplotlib错误:TypeError: unsupported operand type(s) for -: 'str' and 'str'
  详细解决方案

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

热度:12   发布时间:2023-12-26 19:51:00.0
line_chart.add('收盘价', closes)

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

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

 

 

  相关解决方案