路径优化模型中使用pandas库访问索引的时候出现错误,请帮助!
![![]
大佬们,我在使用pandas库实现路径优化的过程中出现了这种报错,请问怎样可以解除?
我已经尝试过的方法:
1.尝试修改pandas库的代码,但是ai提示pandas库本身没有错误,无需修改,而是在使用pandas访问索引的过程中出现问题
2.尝试使用ai解决问题,并查看dataframe索引,已理解代码中的变量和公式内容,但是由于技术有限,不知道如何检查索引是否在访问时出现错误
3.想尝试查看已有的pandas库以及优化模型是否和pycharm版本适配,但是不知道如何操作
请大佬们帮助,万分感谢!
There's nothing shown about what values of your dataframe and key/index, how people can help ?
For example, find all the values of related variables by
print
statement before exception happed when which statement called. So you can reduce your code toException information
Then we can find the answer is that there's no key
1
for dataframedf
.把你的dataframe多少打印出来一些,或者你的代码提供一下,这个错误很可能是loc[i, t] 的第二个参数t引起的,但是也不是很确定。