使用openpyxl.reference从excel创建条形图期间获取TypeError

时间:2018-01-30 07:47:46

标签: python-3.x

使用openpyxl.reference方法从excel创建条形图期间获取TypeError。

以下是完整代码:

  Traceback (most recent call last):
  File "C:\Users\Netskope\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\descriptors\base.py", line 57, in _convert
    value = expected_type(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\naif\python\Aura\Aura_Networks___Python___Excel_Parsers\05-chart.py", line 15, in <module>
    data =   Reference(wsheet, (5, 2), (5, 10))
  File "C:\Users\Netskope\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\chart\reference.py", line 55, in __init__
    self.min_col = min_col
  File "C:\Users\Netskope\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\descriptors\base.py", line 107, in __set__
    value = _convert(self.expected_type, value)
  File "C:\Users\Netskope\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\descriptors\base.py", line 59, in _convert
    raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'int'>
>>> 

获取以下错误:

data =   Reference(wsheet, min_col=5, min_row=2, max_col=5, max_row=10)
categs = Reference(wsheet, min_col=3, min_row=2, max_col=3, max_row=10)

如果我添加以下行来替换上面的行,我就不会收到错误:

circle

0 个答案:

没有答案