简体   繁体   English

未能导入pandas-datareader,“ ImportError:无法从'pandas.compat'导入名称'StringIO'”

[英]Failing to import pandas-datareader, “ImportError: cannot import name 'StringIO' from 'pandas.compat'”

I'm trying to retrieve data using pandas datareader, but when I try to import it, it will not run generating the error below. 我正在尝试使用pandas datareader检索数据,但是当我尝试导入它时,它将无法运行并生成以下错误。 I have installed the latest pandas and pandas-datareader through pip. 我已经通过pip安装了最新的pandas和pandas-datareader。

On a similar question they claimed they solved it by just downgrading to an older version of pandas and pandas-datareader, although when I try to reciprocate this result, it fails to downgrade the two and still continues to have these errors. 在类似的问题上,他们声称他们只是通过降级到较早版本的pandas和pandas-datareader来解决了这一问题,尽管当我尝试兑现此结果时,它无法降级两者,并且仍然继续出现这些错误。 I had more code earlier and thought that the problem lied within the code, but when I decided to comment out everything I realized that the error occurred during importing as shown below. 我之前有更多代码,并认为问题在于代码中,但是当我决定注释掉所有内容时,我意识到错误是在导入期间发生的,如下所示。 There is also more to the error message below but I believe I included the important part, as the rest is just the traceback. 下面的错误消息中还有更多内容,但我相信我包括了重要部分,其余的只是回溯。

import pandas as pd
import pandas_datareader as web
ImportError: cannot import name 'StringIO' from 'pandas.compat' (/Users/roshanamir/Desktop/AI/Pycharm/ATM2/venv/lib/python3.7/site-packages/pandas/compat/__init__.py)

Any help would be appreciated, thank you in advance. 任何帮助将不胜感激,在此先感谢您。

pandas.compat.StringIO was removed when pandas stopped supporting Python 2 in version 0.25.0. 当熊猫停止在0.25.0版中支持Python 2时, pandas.compat.StringIO删除

This has been repaired in pandas datareader and will be released in 0.8.0. 此问题已在pandas datareader中修复,并将在0.8.0中发布。 For now, download the latest development version where the changes are live. 现在,下载更改实时存在的最新开发版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM