[PYTHON] How to load files in Google Drive with Google Colaboratory

Colaboratory is made by google It is a tool that allows you to use the jupyter note environment with a browser.

It is a method to read the file put in Google Drive.

Load sample_submission.csv in Google Drive

2020-03-10_11h07_57.png

Mount Google Drive

Select Mount Drive → Connect to GOOGLE Drive from the file on the left

2020-03-10_11h14_22.png

Check directory

If the connection is successful, You can see your Google Drive files in `python / content / drive / My Drive /`. I put the Google Colaboratory files in Colab Notebooks.

Check the file path

Check the file path this time. Right-click on the file with the mouse. This time, there was sample_submission.csv in the following path

/content/drive/My Drive/Colab Notebooks/sample_submission.csv"



 <img width="427" alt="2020-03-10_11h20_36.png " src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/533844/fb4b2b88-8980-7926-50cc-0ca808a7434d.png ">


## Read the file
 You can read it with the following code.

```python

import pandas as pd
train = pd.read_csv("/content/drive/My Drive/Colab Notebooks/sample_submission.csv")
train.head() 

I was able to read the file safely. 2020-03-10_11h34_19.png

Recommended Posts

How to load files in Google Drive with Google Colaboratory
How to search Google Drive with Google Colaboratory
Download files directly to Google Drive (using Google Colaboratory)
Upload files to Google Drive with Lambda (Python)
How to use Google Colaboratory
How to analyze with Google Colaboratory using Kaggle API
How to use Spacy Japanese model in Google Colaboratory
Download Google Drive files in Python
How to extract any appointment in Google Calendar with Python
How to display formulas in latex when using sympy (> = 1.4) in Google Colaboratory
How to use Google Test in C
How to work with BigQuery in Python
Regularly upload files to Google Drive using the Google Drive API in Python
How to read CSV files in Pandas
Upload images to Google Drive with Python
How to use VS Code (code server) with Google Colab in just 3 lines
How to deal with memory leaks in matplotlib.pyplot
[REAPER] How to play with Reascript in Python
Summary of how to import files in Python 3
How to deal with run-time errors in subprocess.call
How to check / extract files in RPM package
How to get the files in the [Python] folder
How to use tkinter with python in pyenv
How to display videos inline in Google Colab
How to drop Google Docs in one folder in a .txt file with python
How to get a list of files in the same directory with python
How to convert / restore a string with [] in python
How to run AutoGluon in Google Colab GPU environment
How to do hash calculation with salt in Python
Explain in detail how to make sounds with python
How to deal with pyenv initialization failure in fish 3.1.0
How to do zero-padding in one line with OpenCV
How to run tests in bulk with Python unittest
How to install Google Test / Google Mock in Visual Studio 2019
How to access with cache when reading_json in pandas
How to use variables in systemd Unit definition files
How to download files from Selenium in Python in Chrome
How to add page numbers to PDF files (in Python)
How to upload files in Django generic class view
Upload to a shared drive with Google Drive API V3
How to reference static files in a Django project
How to deal with Executing transaction: failed in Anaconda
Building an environment to use CaboCha with google colaboratory
[Implementation explanation] How to use the Japanese version of BERT in Google Colaboratory (PyTorch)
Study Python with Google Colaboratory
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
Mount google drive with google-drive-ocamlfuse
Access Google Drive with Python
How to RDP with Fedora31
How to develop in Python
Try OpenCV with Google Colaboratory
How to Delete with SQLAlchemy?
[TensorFlow 2 / Keras] How to run learning with CTC Loss in Keras
How to handle static files when deploying to production with Django
How to output a document in pdf format with Sphinx
How to not load images when using PhantomJS with Selenium
[Django] How to give input values in advance with ModelForm
How to manipulate the DOM in an iframe with Selenium