Pandas read_csv from url

I’m trying to read a csv-file from given URL, using Python 3.x:

import pandas as pd
import requests

url = "https://github.com/cs109/2014_data/blob/master/countries.csv"
s = requests.get(url).content
c = pd.read_csv(s)

I have the following error

“Expected file path name or file-like object, got <class ‘bytes’> type”

How can I fix this? I’m using Python 3.4

6 Answers
6

Leave a Comment