How to read a CSV file from Google Drive using Google Colab?
In this post I will explain how to read a CSV file from Google Drive using Google Colab in two steps
Before following these steps. You need to upload the CSV file into Google Drive. After uploading follow the below steps
Step1:-
Copy the below code and paste it in colab's cell to mount Google Drive
from google.colab import drive
drive.mount('/content/gdrive')
After executing the above code you will be prompted to click on the link to get authentication to allow Google to access your Drive. After you allow permission, copy the given verification code and paste it in the box in Colab.
Step2:-
Copy the below code and paste it in colab's cell to read the csv file
import pandas as pd
df=pd.read_csv('gdrive/custom_data.csv')
Note:- Replace custom_data.csv with your filename
Comments
Post a Comment