josw123 / dart-fss

한국 금융감독원에서 운영하는 다트(Dart) 시스템 크롤링을 위한 라이브러리
https://github.com/josw123/dart-fss
MIT License
326 stars 111 forks source link

아세아 제지에서 발생하는 오류 #63

Closed josw123 closed 3 years ago

josw123 commented 3 years ago

ValueError Traceback (most recent call last)

in ----> 1 corp.extract_fs(bgn_de='20180101') c:\users\swjo\miniconda3\lib\site-packages\dart_fss\corp\corp.py in extract_fs(self, bgn_de, end_de, fs_tp, separate, report_tp, lang, separator, dataset) 231 232 """ --> 233 return extract(self.corp_code, bgn_de, end_de, fs_tp, separate, report_tp, lang, separator, dataset) c:\users\swjo\miniconda3\lib\site-packages\dart_fss\fs\extract.py in extract(corp_code, bgn_de, end_de, fs_tp, separate, report_tp, lang, separator, dataset) 1292 msg = 'Unexpected Error' 1293 e.args = (*e.args, msg, ) -> 1294 raise e 1295 finally: 1296 dart.utils.spinner.spinner_enable = True c:\users\swjo\miniconda3\lib\site-packages\dart_fss\fs\extract.py in extract(corp_code, bgn_de, end_de, fs_tp, separate, report_tp, lang, separator, dataset) 1260 1261 else: -> 1262 nstatements = analyze_report(report=report, 1263 fs_tp=fs_tp, 1264 separate=separate, c:\users\swjo\miniconda3\lib\site-packages\dart_fss\fs\extract.py in analyze_report(report, fs_tp, separate, lang, separator, dataset) 1134 if separate is False and not xbrl.exist_consolidated(): 1135 raise NotFoundConsolidated('Could not find consolidated financial statements') -> 1136 fs_df = analyze_xbrl(report, fs_tp=fs_tp, separate=separate, lang=lang, 1137 show_abstract=False, show_class=True, show_depth=10, 1138 show_concept=True, separator=separator) c:\users\swjo\miniconda3\lib\site-packages\dart_fss\fs\extract.py in analyze_xbrl(report, fs_tp, separate, lang, show_abstract, show_class, show_depth, show_concept, separator) 1029 statements[tp] = func_fs[tp]() 1030 if statements[tp]: -> 1031 statements[tp] = statements[tp].to_DataFrame(**option) 1032 return statements 1033 c:\users\swjo\miniconda3\lib\site-packages\dart_fss\xbrl\table.py in to_DataFrame(self, cls, lang, start_dt, end_dt, label, show_abstract, show_class, show_depth, show_concept, separator) 214 data = flatten(rows) 215 for idx, r in enumerate(data): --> 216 df.loc[idx] = r 217 218 regex_pass = str_to_regex('concept_id OR label_ko OR label_en OR class') c:\users\swjo\miniconda3\lib\site-packages\pandas\core\indexing.py in __setitem__(self, key, value) 668 669 iloc = self if self.name == "iloc" else self.obj.iloc --> 670 iloc._setitem_with_indexer(indexer, value) 671 672 def _validate_key(self, key, axis: int): c:\users\swjo\miniconda3\lib\site-packages\pandas\core\indexing.py in _setitem_with_indexer(self, indexer, value) 1624 1625 if missing: -> 1626 self._setitem_with_indexer_missing(indexer, value) 1627 return 1628 c:\users\swjo\miniconda3\lib\site-packages\pandas\core\indexing.py in _setitem_with_indexer_missing(self, indexer, value) 1856 # must have conforming columns 1857 if len(value) != len(self.obj.columns): -> 1858 raise ValueError("cannot set a row with mismatched columns") 1859 1860 value = Series(value, index=self.obj.columns, name=indexer) ValueError: ('cannot set a row with mismatched columns', "An error occurred while fetching or analyzing {'rcp_no': '20190329003134', 'corp_code': '00138729', 'corp_name': '아세아제지', 'stock_code': '002310', 'corp_cls': 'Y', 'report_nm': '사업보고서 (2018.12)', 'flr_nm': '아세아제지', 'rcept_dt': '20190329', 'rm': '연'}.")
josw123 commented 3 years ago

재무제표를 Pandas DataFrame으로 변환하는 과정에서 아래와 같이 일부 컬럼의 이름이 중복되는 문제로 인하여 발생하는 오류

('20181231', ('연결재무제표', '주식발행초과금'))

('20171231', ('연결재무제표', '주식발행초과금'))

('20161231', ('연결재무제표', '주식발행초과금'))

영문 컬럼명은 중복되지 않았으나 한글 컬럼명은 중복되어 발생하는 문제