Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError raised by get_rdataset("Guerry", "HistData") #1745

Closed
edschofield opened this issue Jun 6, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@edschofield
Copy link

commented Jun 6, 2014

The following line from the formulas example notebook (from Git master):

    dta = sm.datasets.get_rdataset("Guerry", "HistData", cache=True)

causes this exception to be raised on Py3.3 (with statsmodels v0.5.0):

---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-6-0b450e8cdfce> in <module>()
----> 1 dta = sm.datasets.get_rdataset("Guerry", "HistData", cache=True)

/home/user/anaconda/lib/python3.3/site-packages/statsmodels/datasets/utils.py in get_rdataset(dataname, package, cache)
    251 
    252     title = _get_dataset_meta(dataname, package, cache)
--> 253     doc, _ = _get_data(docs_base_url, dataname, cache, "rst")
    254 
    255     return Dataset(data=data, __doc__=doc.read(), package=package, title=title,

/home/user/anaconda/lib/python3.3/site-packages/statsmodels/datasets/utils.py in _get_data(base_url, dataname, cache, extension)
    185     #Python 3, don't think there will be any unicode in r datasets
    186     if sys.version[0] == '3':  # pragma: no cover
--> 187         data = data.decode('ascii', errors='strict')
    188     return StringIO(data), from_cache
    189 

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1288: ordinal not in range(128)

Notice the comment on line 185 of utils.py. It looks like that assumption is wrong.

@edschofield edschofield changed the title ``UnicodeDecodeError`` raised by ``get_rdataset("Guerry", "HistData")`` UnicodeDecodeError raised by get_rdataset("Guerry", "HistData") Jun 6, 2014

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Jun 6, 2014

see #1055
This looks fixed in master.

@edschofield

This comment has been minimized.

Copy link
Author

commented Jun 6, 2014

Thanks, @josef-pkt. Shall we close this issue then?

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Jun 6, 2014

yes

@josef-pkt josef-pkt closed this Jun 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.