why not just pass the URL directly to pd.read_csv?

Source: Artificial Intelligence on Medium

# read only first 10 rows
df = pd.read_csv(io.StringIO(s.decode(‘utf-8’)),nrows=10 , index_col=0)