kaggle 설치 및 샘플(titanic) 데이터 다운로드하기

potato·2021년 6월 30일
0

kaggle 설치 ( pip가 설치 되어있는 환경에서 시작.. )

# pip install kaggle --upgrade

kaggle 바로 받으려하면 오류 발생

# kaggle competitions download -c titanic
raceback (most recent call last):
  File "/opt/conda/bin/kaggle", line 5, in <module>
    from kaggle.cli import main
  File "/opt/conda/lib/python3.7/site-packages/kaggle/__init__.py", line 23, in <module>
    api.authenticate()
  File "/opt/conda/lib/python3.7/site-packages/kaggle/api/kaggle_api_extended.py", line 166, in authenticate
    self.config_file, self.config_dir))
OSError: Could not find kaggle.json. Make sure it's located in /aiffel/.kaggle. Or use the environment method.
  • 오류에 대해 검색해보니 뭔가 전처리가 필요함 -_-;

kaggle 회원가입 및 키 파일 복사

  1. https://www.kaggle.com/ 에서 가입

  2. Home > account > [API] - Create New API Token 클릭

  3. 저장된 파일을 ~/.kaggle 폴더로 복사

# cp kaggle.json ~/.kaggle/
# chmod 600 ~/.kaggle/kaggle.json
# cat ~/.kaggle/kaggle.json
{"username":"sjpotato","key":"xxxx"}
 * 확인해보니 kaggle 사이트의 계정과 token 키정보가 있음

kaggle에서 관련 파일 다운로드

# kaggle competitions download -c titanic
Downloading titanic.zip to /aiffel
  0%|                                                                                        | 0.00/34.1k [00:00<?, ?B/s]
100%|███████████████████████████████████████████████████████████████████████████████| 34.1k/34.1k [00:00<00:00, 7.11MB/s]
profile
안녕하세요~

0개의 댓글