inflearn logo
강의

Khóa học

Chia sẻ kiến thức

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

키에러가 납니다

635

ubih1un4679

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

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

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

0

niceman

안녕하세요.

 

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

 

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

현재 예제에서 error 발생

0

370

3

유튜브 동영상 다운로드

0

1452

2

Atom 에디터 관련

0

339

1

위시켓 폼데이터

0

274

1

스케줄러 사용 관련 질문 드립니다

0

629

1

selenium 에러

0

429

1

Progress bar 쓰레드 관련

0

491

1

Install Package 관련 문의

0

330

1

tkinter 샘플 코드 실행 오류 건

0

1271

1

4-7-6 네이버 & 카카오 주식 정보 가져오기

0

381

1

네이버자동로그인_by_selenium

0

877

1

위시캣 로그인 처리 및 크롤링 질문

0

348

1

2-8-1 네이버이미지 크롤링 질문

1

607

3

li:nth-of-type 질문

0

352

2

에러가 뜨는데 잘 모르겠어요ㅠ

0

402

2

Install Packages 항목이 안보이는 이유가 뭘까요?

0

402

2

환경변수 Path 설정 방법

0

634

1

웹 브라우저 없는 스크랩핑 및 파싱 실습(1) - 인프런

0

337

1

웹 브라우저 없는 스크랩핑 및 파싱 실습(1) -git주소

0

480

3

download2-8-1. py질문

0

206

1

ip 차단 당하는 거 같은데 아무리 랜덤주고, sleep 줘도 안 되는데 다른 방법 더 있을까요??

0

646

1

인프런 환경이 바뀌어서 제나름대로 하는데

0

197

1

다시올려주신 예제파일로하는데

0

191

1

아직도 에러가뜨나보네요?

0

585

1