Data Analysis with Python- Google Colab

Hi all,

I’m having trouble running the exercise notebook files for the Pandas exercises in Google Colab (as instructed). I open the exercise files from Github in Google Colab. When I try to run the code blocks in the notebook, it can’t read in the associated csv file from the Github repository. Can someone please walk me through how to fix this?

1 Like

Hi,

  • Go to the GitHub repository
  • click on the .csv file
  • it will open in your browser like a table…
  • on right side you will find some clickable icon ( [Raw] [Blame] [A desctop icon] …)
  • click on [Raw] button
  • the .csv file now open like any text…

Now you have two options.

  1. copy and save on your google drive (or on your pc) for later use
  2. copy the link and open from this link in your colab.

The link will be start with
https://raw.githubusercontent.com/...

In your colab code:

url = "https://raw.githubusercontent.com/..."
df = pd.read_csv(url)
df.head()

My colab example

3 Likes

Thanks, that was super helpful! :slight_smile: