找不到名为 pandas.io.data 的模块

no module named pandas.io.data found

import pandas.io.data as wb
df=wb.Datareader('AAPL','google','2022/01/01','2022/01/01')
df.head()

我在 jupyter notebook 上 运行 这个代码,但我得到这个 module not found error

注意pandas.io.data模块被移动到单独的包(pandas-datareader)

所以,安装

pip install pandas-datareader

使用

import pandas_datareader

最终,这可以工作

from pandas_datareader import data
df=data.DataReader('AAPL','yahoo','2016/1/1','2017/1/1')
df.head()