Tool organization: Google Colaboratory (updated 2020.2.24)

Purpose

――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

table of contents

  1. Template

1. Template

--Rewrite "XXX" and "../input/data" to your own folder and use. --Content

  1. Mount on Google Drive
  2. Elapsed time display
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

Tool organization: Google Colaboratory (updated 2020.2.24)
Google colaboratory
Google Colaboratory setup summary
Is it Google Colaboratory?
Use music21 on Google Colaboratory
Try StyleGAN on Google Colaboratory
Google form aggregate analysis tool
Try OpenCV with Google Colaboratory
Pandas 100 knocks on Google Colaboratory
How to use Google Colaboratory
■ [Google Colaboratory] Use morphological analysis (janome)
■ [Google Colaboratory] Use morphological analysis (MeCab)
Snippets (scraping) registered in Google Colaboratory
OpenCV feature detection with Google Colaboratory
100 language processing knock 2020 "for Google Colaboratory"
Run Keras on Google Colaboratory TPU