Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5장 DBUpdater Key Error 문의드립니다. #157

Open
hyul0408 opened this issue Jul 26, 2022 · 1 comment
Open

5장 DBUpdater Key Error 문의드립니다. #157

hyul0408 opened this issue Jul 26, 2022 · 1 comment

Comments

@hyul0408
Copy link

runfile('C:/python/DBUpdater.py_final.py', wdir='C:/python')
C:\Users\minha\AppData\Roaming\Python\Python39\site-packages\pandas\io\sql.py:761: UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy
warnings.warn(
Traceback (most recent call last):

File "C:\Users\minha\AppData\Roaming\Python\Python39\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc
return self._engine.get_loc(casted_key)

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

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

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

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

KeyError: 'code'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "C:\python\DBUpdater.py_final.py", line 168, in
dbu.execute_daily()

File "C:\python\DBUpdater.py_final.py", line 135, in execute_daily
self.update_comp_info()

File "C:\python\DBUpdater.py_final.py", line 58, in update_comp_info
self.codes[df['code'].values[idx]] = df['company'].values[idx]

File "C:\Users\minha\AppData\Roaming\Python\Python39\site-packages\pandas\core\frame.py", line 3505, in getitem
indexer = self.columns.get_loc(key)

File "C:\Users\minha\AppData\Roaming\Python\Python39\site-packages\pandas\core\indexes\base.py", line 3623, in get_loc
raise KeyError(key) from err

KeyError: 'code'

@INVESTAR
Copy link
Owner

self.codes[df['code'].values[idx]]=df['company'].values[idx]
위 코드에서 키 에러가 발생한 것으로 봐서
company_info 테이블의 code 컬럼 쪽을 확인해 보시는 게 좋겠습니다.

#140 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants