Last active
February 17, 2021 17:51
-
-
Save Vaidic/5aafd90b9fc2acfa42a20deee636a2c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip uninstall kaggle -y && pip install kaggle | |
| import json | |
| import zipfile | |
| import os | |
| api_token = {"username":"USERNAME","key":"KEY"} | |
| !mkdir /root/.kaggle | |
| with open('/root/.kaggle/kaggle.json', 'w') as file: | |
| json.dump(api_token, file) | |
| !chmod 600 /root/.kaggle/kaggle.json | |
| !kaggle config set -n path -v/content | |
| !kaggle config view | |
| dataset = 'titanic' # change this to the dataset to download | |
| os.environ['dataset']=dataset | |
| !echo $dataset | |
| !kaggle competitions download -c $dataset | |
| !ls /content/competitions/$dataset | |
| os.chdir('/content/competitions/'+dataset) | |
| for file in os.listdir(): | |
| zip_ref = zipfile.ZipFile(file, 'r') | |
| zip_ref.extractall() | |
| zip_ref.close() | |
| os.listdir() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment