[Error]Expecting value: line 1 column 1 (char 0)
amzn_df = fdr.DataReader('AMZN', '2018','2020')
amzn_df
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
C:\Users\Public\Documents\ESTsoft\CreatorTemp/ipykernel_9328/2668210119.py in <module>
----> 1 amzn_df = fdr.DataReader('AMZN', '2018','2020')
2 amzn_df
~\anaconda3\lib\site-packages\FinanceDataReader\data.py in DataReader(symbol, start, end, exchange, data_source)
39 # Investing
40 reader = InvestingDailyReader
---> 41 df = reader(symbol, start, end, exchange, data_source).read()
42 end = min([pd.to_datetime(end), datetime.today()])
43 while len(df) and df.index[-1] < end: # issues/30
~\anaconda3\lib\site-packages\FinanceDataReader\investing\data.py in read(self)
60 start_date_str = self.start.strftime('%m/%d/%Y')
61 end_date_str = self.end.strftime('%m/%d/%Y')
---> 62 curr_id = self._get_currid_investing(self.symbol, self.exchange, self.data_source)
63 if not curr_id:
64 raise ValueError("Symbol unsupported or not found")
~\anaconda3\lib\site-packages\FinanceDataReader\investing\data.py in _get_currid_investing(self, symbol, exchange, data_source)
28 }
29 r = requests.post(url, data={'search_text': symbol}, headers=headers)
---> 30 jo = json.loads(r.text)
31 if len(jo['quotes']) == 0:
32 raise ValueError(f"Symbol('{symbol}') not found")
~\anaconda3\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
348 cls = JSONDecoder
~\anaconda3\lib\json\decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
~\anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
FinanceDataReader 를 이용하던 중 디코더 오류가 발생
Why?
크롤링이나 API 관련 코드들은 Target 사이트의 정보가 바뀔때 유지보수할 필요가 있다.
해결
https://github.com/FinanceData/FinanceDataReader/wiki/
pip install -U finance-datareader
Author And Source
이 문제에 관하여([Error]Expecting value: line 1 column 1 (char 0)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@htright/ErrorExpecting-value-line-1-column-1-char-0저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)