Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

I am working in a virtual environment. I am able to import and work in pandas without any error but when I am trying to import pandas_datareader

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

import datetime as dt

from matplotlib import style

import pandas_datareader as web

it is giving following error -

Traceback (most recent call last):

  File "stock.py", line 6, in <module>

    import pandas_datareader as web

  File "/home/xxxxx/django-apps/env/lib/python3.5/site-packages/pandas_datareader/__init__.py", line 2, in <module>

    from .data import (DataReader, Options, get_components_yahoo,

  File "/home/xxxxx/django-apps/env/lib/python3.5/site-packages/pandas_datareader/data.py", line 14, in <module>

    from pandas_datareader.fred import FredReader

  File "/home/xxxxx/django-apps/env/lib/python3.5/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'

(env) xxxxx@xxxxx-yyyyy ~/pyt $ python stock.py

Traceback (most recent call last):

  File "stock.py", line 6, in <module>

    import pandas_datareader

  File "/home/xxxxx/django-apps/env/lib/python3.5/site-packages/pandas_datareader/__init__.py", line 2, in <module>

    from .data import (DataReader, Options, get_components_yahoo,

  File "/home/xxxxx/django-apps/env/lib/python3.5/site-packages/pandas_datareader/data.py", line 14, in <module>

    from pandas_datareader.fred import FredReader

  File "/home/xxxxx/django-apps/env/lib/python3.5/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'

1 Answer

0 votes
by (41.4k points)

Defining is_list_like:

import pandas as pd

pd.core.common.is_list_like = pd.api.types.is_list_like

before

import pandas_datareader as web

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...