――Domestic analysis competitions such as SIGNATE and Nishika do not have a calculation platform, so it has become difficult for them to use their own notebook PCs. So, a memo about how to use Google Colaboratory for yourself. Kaggle has a computing platform, so there's no problem.
--Scheduled to be updated each time 2020.2.24 --Template creation
--Rewrite "XXX" and "../input/data" to your own folder and use. --Content
import os
path = None
#Platform judgment
# nt:Windows system,Other than that, Google Colab
if os.name == 'nt':
#Local folder
path = '../input/data/'
else:
# (1)Mount on Google Drive
from google.colab import drive
drive.mount('/content/drive')
!ls drive/My\ Drive/'Colab Notebooks'/XXX/input/data
path = "./drive/My Drive/Colab Notebooks/XXX/input/data/"
# (2)Elapsed time confirmation(For 12-hour rule)
!cat /proc/uptime | awk '{print $1 /60 /60 /24 "days (" $1 / 60 / 60 "h)"}'
print('os:',os.name)
print('path:',path)
Recommended Posts