问题
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 print
s 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