FS#58912 - [python-pandas-datareader] ImportError

Attached to Project: Community Packages
Opened by Alex (zreeon) - Thursday, 07 June 2018, 13:36 GMT
Last edited by Andrzej Giniewicz (Giniu) - Saturday, 11 August 2018, 17:27 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Andrzej Giniewicz (Giniu)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

python-pandas-datareader is broken currently due to an upstream bug:

import pandas_datareader.data as web

results in an ImportError:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alex/Sync/Finances/getquote", line 5, in <module>
import pandas_datareader.data as web
File "/usr/lib/python3.6/site-packages/pandas_datareader/__init__.py", line 2, in <module>
from .data import (DataReader, Options, get_components_yahoo,
File "/usr/lib/python3.6/site-packages/pandas_datareader/data.py", line 14, in <module>
from pandas_datareader.fred import FredReader
File "/usr/lib/python3.6/site-packages/pandas_datareader/fred.py", line 1, in <module>
from pandas.core.common import is_list_like
ImportError: cannot import name 'is_list_like'

This is fixed in upstream git but not in a release yet: https://github.com/pydata/pandas-datareader/pull/520

Additional info:
* 0.6.0-2
This task depends upon

Closed by  Andrzej Giniewicz (Giniu)
Saturday, 11 August 2018, 17:27 GMT
Reason for closing:  Fixed
Additional comments about closing:  0.6.0-4
Comment by Alex (zreeon) - Wednesday, 20 June 2018, 00:07 GMT
I was able to fix this by applying this diff, which is more-or-less what's in that link above.

diff --git a/pandas_datareader/compat/__init__.py b/pandas_datareader/compat/__init__.py
index 58496335..46c68b78 100644
--- a/pandas_datareader/compat/__init__.py
+++ b/pandas_datareader/compat/__init__.py
@@ -14,6 +14,7 @@
PANDAS_0190 = (PANDAS_VERSION >= LooseVersion('0.19.0'))
PANDAS_0200 = (PANDAS_VERSION >= LooseVersion('0.20.0'))
PANDAS_0210 = (PANDAS_VERSION >= LooseVersion('0.21.0'))
+PANDAS_0230 = (PANDAS_VERSION >= LooseVersion('0.23.0'))

if PANDAS_0190:
from pandas.api.types import is_number
@@ -39,6 +40,12 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
from pandas.util.testing import assertRaisesRegexp as assert_raises_regex
get_filepath_or_buffer = com.get_filepath_or_buffer

+if PANDAS_0230:
+ from pandas.core.dtypes.common import is_list_like
+else:
+ from pandas.core.common import is_list_like
+
+
if compat.PY3:
from urllib.error import HTTPError
else:
diff --git a/pandas_datareader/fred.py b/pandas_datareader/fred.py
index c1eba812..666c4223 100644
--- a/pandas_datareader/fred.py
+++ b/pandas_datareader/fred.py
@@ -1,4 +1,5 @@
-from pandas.core.common import is_list_like
+from pandas_datareader.compat import is_list_like
+
from pandas import concat, read_csv

from pandas_datareader.base import _BaseReader

Loading...