Last active
June 12, 2021 04:09
-
-
Save atyrachma/98e7b0b1122cc85731b4d2d12efaad2a to your computer and use it in GitHub Desktop.
py-import-to-colab.py
This file contains 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
#from kaggle | |
# Colab library to upload files to notebook | |
from google.colab import files | |
# Install Kaggle library | |
!pip install -q kaggle | |
#update dulu | |
!pip install kaggle --upgrade | |
# Upload kaggle API key file | |
uploaded = files.upload() | |
##for fn in uploaded.keys(): | |
## print('User uploaded file "{name}" with length {length} bytes'.format( | |
## name=fn, length=len(uploaded[fn]))) | |
# Then move kaggle.json into the folder where the API expects to find it. | |
!mkdir -p ~/.kaggle/ && mv kaggle.json ~/.kaggle/ && chmod 600 ~/.kaggle/kaggle.json | |
# Downlaod data from past challenge | |
!kaggle --version | |
!kaggle competitions download -c shopee-sentiment-analysis --force | |
import pandas as pd | |
# Import the test and train datasets into pandas dataframe | |
df_train = pd.read_csv('train.csv.zip', compression='zip', header=0, sep=',', quotechar='"') | |
df_test = pd.read_csv('test.csv.zip', compression='zip', header=0, sep=',', quotechar='"') | |
import numpy as np | |
np.size(df_train) #clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment