您好,登錄后才能下訂單哦!
怎么在python3中使用pandas獲取股票數(shù)據(jù)?針對這個問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
如下所示:
from pandas_datareader import data, wb from datetime import datetime import matplotlib.pyplot as plt end = datetime.now() start = datetime(end.year - 1, end.month, end.day) alibaba = data.DataReader('BABA', 'yahoo', start, end) alibaba['Adj Close'].plot(legend=True, figsize=(10,4)) plt.show()
pandas版本0.23.1
進(jìn)入命令行窗口,在python安裝目錄下,進(jìn)入Scripts,輸入命令pip install pandas
pandas_datareader版本0.6.0
進(jìn)入命令行窗口,在python安裝目錄下,進(jìn)入Scripts,輸入命令pip install pandas_datareader
問題:
運行時報錯:ImportError: cannot import name 'is_list_like'
解決:
修改D:\Python36\Lib\site-packages\pandas_datareader\fred.py
將from pandas.core.common import is_list_like改為from pandas.api.types import is_list_like
問題:
運行時報錯:raise ImmediateDeprecationError(DEP_ERROR_MSG.format('Yahoo Daily'))
解決:
修改D:\Python36\Lib\site-packages\pandas_datareader\data.py
注釋掉raise ImmediateDeprecationError(DEP_ERROR_MSG.format('Yahoo Daily'))
關(guān)于怎么在python3中使用pandas獲取股票數(shù)據(jù)問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。