pandas_datareader“无法导入名称数据”

时间:2019-01-25 03:09:21

标签: python python-2.7

我正试图将熊猫导入程序中以制作财务程序,并且我的代码看起来像这样(我的IDE是PyCharm)-

from pandas_datareader import data
import matplotlib.pyplot as plt
import pandas as pd

但是,当我尝试运行代码时,出现此错误消息-

Traceback (most recent call last):
File "/Users/benjamin/PycharmProjects/pandas/venv/pandas.py", line 1, in <module>
from pandas_datareader import data
File "/Users/benjamin/PycharmProjects/pandas/venv/lib/python2.7/site- 
packages/pandas_datareader/__init__.py", line 2, in <module>
from .data import (DataReader, Options, get_components_yahoo,
File "/Users/benjamin/PycharmProjects/pandas/venv/lib/python2.7/site-packages/pandas_datareader/data.py", line 7, in <module>
from pandas_datareader.av.forex import AVForexReader
File "/Users/benjamin/PycharmProjects/pandas/venv/lib/python2.7/site-packages/pandas_datareader/av/__init__.py", line 3, in <module>
from pandas_datareader.base import _BaseReader
File "/Users/benjamin/PycharmProjects/pandas/venv/lib/python2.7/site-packages/pandas_datareader/base.py", line 7, in <module>
import pandas.compat as compat
File "/Users/benjamin/PycharmProjects/pandas/venv/pandas.py", line 1, in <module>
from pandas_datareader import data
ImportError: cannot import name data

2 个答案:

答案 0 :(得分:2)

您的熊猫版本应为> = 0.19.0,以便从 pandas_datareader 导入数据。

Pandas Datareader

答案 1 :(得分:0)

查看此问题以获取更多线索:

import pandas_datareader gives ImportError: cannot import name 'is_list_like'

使用“ pip Frozen”获取具有版本号的模块列表,并检查是否存在任何不一致之处