Dash traceback not leading to any line in my code

五迷三道 提交于 2020-01-25 06:39:07

问题


I am working on my first Dash app. I am getting the following error:

"Cannot set a frame with no defined index "

The issue is that the traceback doesn’t lead to any line in my code. It only goes through installed libraries:

Traceback (most recent call last):
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\frame.py", line 3540, in _ensure_valid_index
    value = Series(value)
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\series.py", line 316, in __init__
    data = SingleBlockManager(data, index, fastpath=True)
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\internals\managers.py", line 1516, in __init__
    block = make_block(block, placement=slice(0, len(axis)), ndim=1)
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\internals\blocks.py", line 3284, in make_block
    return klass(values, ndim=ndim, placement=placement)
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\internals\blocks.py", line 2792, in __init__
    super().__init__(values, ndim=ndim, placement=placement)
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\internals\blocks.py", line 128, in __init__
    "{mgr}".format(val=len(self.values), mgr=len(self.mgr_locs))
ValueError: Wrong number of items passed 3, placement implies 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\LIAG8802\Documents\Procurement_analytics\venv\lib\site-packages\pandas\core\frame.py", line 3543, in _ensure_valid_index
    "Cannot set a frame with no defined index "
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series

How can I know which line in my code is causing the error? (Also if you have an explanation for the error that would help).

EDIT: note that I cannot track the issue putting prints at several lines since the error pops out in the dash debug console, not in the anaconda console which does not crash

来源:https://stackoverflow.com/questions/59837535/dash-traceback-not-leading-to-any-line-in-my-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!