添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Conflict with Pandas 0.25.0 and pandas-datareader 0.7.0.
On Python 3.7.3

import pandas_datareader as pdr

raises exception:
/usr/local/lib/python3.7/dist-packages/pandas_datareader/base.py in
9 from pandas import read_csv, concat
10 from pandas.io.common import urlencode
---> 11 from pandas.compat import StringIO, bytes_to_str
13 from pandas_datareader._utils import (RemoteDataError, SymbolWarning,

ImportError: cannot import name 'StringIO' from 'pandas.compat' (/usr/local/lib/python3.7/dist-packages/pandas/compat/ init .py)

Facing same error, even tho it just warns about StringIO, which, apparently is in IO, neither StringIO or bytes_to_str are in compat, and there are a lot of files calling it from there.
After changing the sublibrary in all those files and coding the bytes_to_str function, there are still more sublibraries missing in compat, at least lmap.

Tested in two different machines, windows and linux.

Hope we can find a fix soon.

Have re-installed Pandas 0.25.0 and pandas-datareader from dev (0.7.0+55.g874b385).
I can confirm the original error is no longer raised, many thanks.
But as @ricpruss mentions above we now get this exception:

/usr/local/lib/python3.7/dist-packages/pandas_datareader/base.py in
10 from pandas import read_csv, concat
11 from pandas.io.common import urlencode
---> 12 from pandas.compat import bytes_to_str
14 from pandas_datareader._utils import (RemoteDataError, SymbolWarning,

ImportError: cannot import name 'bytes_to_str' from 'pandas.compat' (/usr/local/lib/python3.7/dist-packages/pandas/compat/ init .py)

Work around is to roll back to prior version of Pandas 0.24.2
pip3 install --upgrade pandas==0.24.2

pipenv install pandas~=0.24.2

Thanks, but I can still reproduce the problem with Python 3.6.8 on Ubuntu 18.04:

$ python3 -m venv venv
$ . venv/bin/activate
$ pip3 install pandas-datareader
Collecting pandas-datareader
# output omitted for brevity
Installing collected packages: numpy, pytz, six, python-dateutil, pandas, idna, chardet, urllib3, certifi, requests, wrapt, lxml, pandas-datareader
Successfully installed certifi-2019.6.16 chardet-3.0.4 idna-2.8 lxml-4.4.0 numpy-1.17.0 pandas-0.25.0 pandas-datareader-0.7.1 python-dateutil-2.8.0 pytz-2019.1 requests-2.22.0 six-1.12.0 urllib3-1.25.3 wrapt-1.11.2
$ venv/bin/python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas_datareader as pdr
# some traceback skipped for brevity
  File "/home/foo/testdir/venv/lib/python3.6/site-packages/pandas_datareader/base.py", line 11, in <module>
    from pandas.compat import StringIO, bytes_to_str
ImportError: cannot import name 'StringIO'
  TravelTrader, kwang2610, dybenko1, wen00031, scienclick, nicoleeesim, aondoe, ErickMwazonga, Aniratawa, shashankvemuri, and 4 more reacted with thumbs up emoji
  TravelTrader, Aniratawa, and shashankvemuri reacted with laugh emoji
  TravelTrader, wen00031, Aniratawa, and shashankvemuri reacted with rocket emoji
      All reactions