How to Read CSV Files in Google Colab

How to read CSV file in Google Colab

This post represents a quick code sample in relation to uploading a CSV file from local drive to Google Colab Notebook.

Executing the code below will prompt to select a file from the local drive and upload.

import pandas as pd
import io
from google.colab import files
uploaded = files.upload()

Once done with the above, all you need to do is execute the following code:

df = pd.read_csv(io.BytesIO(uploaded['FileName.csv']))

In order to test if the file is loaded appropriately, execute the following command:


Ajitesh Kumar
Follow me

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking
Posted in AI, Data Science, Machine Learning. Tagged with , .

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.