1

I have the following code which works fine in Google Colab, but throws an error when run in QuantConnect's Jupyter Notebook on their site. Any idea why this could be and how to make it work within the QuantConnect notebook?

import pandas as pd
url = 'https://raw.githubusercontent.com/QuantConnect/Lean/master/Data/symbol-properties/symbol-properties-database.csv'
df = pd.read_csv(url)
df.head()

The error it is giving below. Seems like maybe something with the encoding is the issue, but I've tried setting various encodings into the read_csv function with nothing working.

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
/opt/miniconda3/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1317                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error
Ryan Miller
  • 133
  • 9

1 Answers1

0

Do you have the same error with the following code?

import io
import pandas as pd
import requests

res = requests.get(r'https://raw.githubusercontent.com/QuantConnect/Lean/master/Data/symbol-properties/symbol-properties-database.csv')
text_csv = res.text
df = pd.read_csv(io.StringIO(text_csv))
quasi-human
  • 1,898
  • 1
  • 2
  • 13