강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của ubih1un4679
ubih1un4679

câu hỏi đã được viết

Python cơ bản và tạo nhiều ứng dụng tự động hóa khác nhau bằng cách sử dụng web crawling

Sử dụng Python Pandas (3) - Biểu đồ cổ phiếu Daum, Naver

키에러가 납니다

Viết

·

624

0

뉴버전 보고있는데 

             Close    Open    High     Low      Volume  Change

Date                                                          

2019-04-22  204.53  202.83  204.94  202.34  19440000.0  0.0033

2019-04-23  207.48  204.43  207.75  203.90  23320000.0  0.0144

2019-04-24  207.16  207.36  208.48  207.05  17540000.0 -0.0015

2019-04-25  205.28  206.83  207.76  205.12  18540000.0 -0.0091

2019-04-26  204.30  204.90  205.00  202.12  18650000.0 -0.0048

2019-04-29  204.61  204.40  205.97  203.86  22200000.0  0.0015

2019-04-30  209.95  202.69  209.95  199.17   1730000.0  0.0261

Traceback (most recent call last):

  File "pandas/_libs/index.pyx", line 457, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/hashtable_class_helper.pxi", line 811, in pandas._libs.hashtable.Int64HashTable.get_item

TypeError: an integer is required

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2525, in get_loc

    return self._engine.get_loc(key)

  File "pandas/_libs/index.pyx", line 421, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 459, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 465, in pandas._libs.index.DatetimeEngine._date_check_type

KeyError: '2016-02-25'

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "pandas/_libs/index.pyx", line 457, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/hashtable_class_helper.pxi", line 811, in pandas._libs.hashtable.Int64HashTable.get_item

TypeError: an integer is required

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py", line 1435, in get_loc

    return Index.get_loc(self, key, method, tolerance)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2527, in get_loc

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

  File "pandas/_libs/index.pyx", line 421, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 459, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 465, in pandas._libs.index.DatetimeEngine._date_check_type

KeyError: '2016-02-25'

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "pandas/_libs/index.pyx", line 449, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/hashtable_class_helper.pxi", line 811, in pandas._libs.hashtable.Int64HashTable.get_item

  File "pandas/_libs/hashtable_class_helper.pxi", line 817, in pandas._libs.hashtable.Int64HashTable.get_item

KeyError: 1456358400000000000

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2525, in get_loc

    return self._engine.get_loc(key)

  File "pandas/_libs/index.pyx", line 421, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 451, in pandas._libs.index.DatetimeEngine.get_loc

KeyError: Timestamp('2016-02-25 00:00:00')

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "pandas/_libs/index.pyx", line 449, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/hashtable_class_helper.pxi", line 811, in pandas._libs.hashtable.Int64HashTable.get_item

  File "pandas/_libs/hashtable_class_helper.pxi", line 817, in pandas._libs.hashtable.Int64HashTable.get_item

KeyError: 1456358400000000000

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py", line 1444, in get_loc

    return Index.get_loc(self, stamp, method, tolerance)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2527, in get_loc

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

  File "pandas/_libs/index.pyx", line 421, in pandas._libs.index.DatetimeEngine.get_loc

  File "pandas/_libs/index.pyx", line 451, in pandas._libs.index.DatetimeEngine.get_loc

KeyError: Timestamp('2016-02-25 00:00:00')

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Users/hyeonseongjun/Desktop/inflearn/section2/test/bnmva23-1/download4-7-3.py", line 24, in <module>

    print(df_app.ix['2016-02-25'])

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 127, in __getitem__

    return self._getitem_axis(key, axis=axis)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1108, in _getitem_axis

    return self._get_label(key, axis=axis)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 145, in _get_label

    return self.obj._xs(label, axis=axis)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py", line 2344, in xs

    loc = self.index.get_loc(key)

  File "/Users/hyeonseongjun/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py", line 1446, in get_loc

    raise KeyError(key)

KeyError: '2016-02-25'

에러메세지인데요 혹시나 해서 복붙해봤는데 역시나 마찬가지입니다

python웹-크롤링

Câu trả lời 2

0

ubih1un4679님의 프로필 이미지
ubih1un4679
Người đặt câu hỏi

감사합니다 조만간 확인해볼게요!

0

niceman님의 프로필 이미지
niceman
Người chia sẻ kiến thức

안녕하세요.

 

현재 해당 예제파일 실행한 결과 정상적으로 실행됩니다.

 

https://github.com/eunki7/python_create_app_1/blob/master/section4/4-7-3_new_1.py

 

실행 파일이름이 예전 파일 이름 같습니다.

 

위에 수정된 버전인 새로운 예제 확인해보시고요.

 

아래 처럼 새로나온 패키지가 설치되어 있는지 확인 해보세요.

 

pip install -U finance-datareader

 

새로운 패키지에대한 사이트 입니다.

 

https://financedata.github.io/posts/finance-data-reader-users-guide.html

Hình ảnh hồ sơ của ubih1un4679
ubih1un4679

câu hỏi đã được viết

Đặt câu hỏi