python大神写的代码_小白,照着写的代码 都报错。。。。并且看不懂,求大神指点...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

Traceback (most recent call last):

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 3078, in get_loc

return self._engine.get_loc(key)

File "pandas\_libs\index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc

File "pandas\_libs\index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc

File "pandas\_libs\hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item

File "pandas\_libs\hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'city_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\admin\Desktop\我去年买了个表\毕设\city_detail.py", line 93, in

class Schedule(object):

File "C:\Users\admin\Desktop\我去年买了个表\毕设\city_detail.py", line 94, in Schedule

c = city_detail_deal()

File "C:\Users\admin\Desktop\我去年买了个表\毕设\city_detail.py", line 13, in __init__

self.id = df['city_id']

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\frame.py", line 2688, in __getitem__

return self._getitem_column(key)

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\frame.py", line 2695, in _getitem_column

return self._get_item_cache(key)

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\generic.py", line 2489, in _get_item_cache

values = self._data.get(item)

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\internals.py", line 4115, in get

loc = self.items.get_loc(item)

File "C:\Users\admin\Anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 3080, in get_loc

return self._engine.get_loc(self._maybe_cast_indexer(key))

File "pandas\_libs\index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc

File "pandas\_libs\index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc

File "pandas\_libs\hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item

File "pandas\_libs\hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'city_id'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值