I am working with jupyter notebook using google colab(all the files are in the drive). I have 2 files: Exploratory_Data_Analysis.ipynb et PCA.ipynb. I want to import to use the data comming from first one in the secon one. using only the jupyter notebook locally(not with google colaboratory), the importing is working simply by doing this:
!pip install import-ipynb
import import_ipynb
import Exploratory_Data_Analysis as eda
But with google colab I tried the following:
!pip install import-ipynb
import import_ipynb
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
import os
import pandas as pd
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
listed = drive.ListFile({'q': "'1CXqv7-PZmYrWes4MOk' in
parents and trashed=false"}).GetList()
for file in listed:
print('title {}, id {}'.format(file['title'], file['id']))
eda = os.path.join(download_path, 'Exploratory_Data_Analysis.ipynb')
temp_eda = drive.CreateFile({'id': '1YpDhXGeJVtzuxUJS5gKsUbm'})
temp_eda.GetContentFile(eda)
import Exploratory_Data_Analysis
and getting this:
importing Jupyter notebook from Exploratory_Data_Analysis.ipynb
NotJSONError: Notebook does not appear to be JSON: ''...
are there any other ways to import its own ipynb files on google colab?