[英]Python / Pandas Reading Data with pandas-datareader from Yahoo Issue
FutureWarning: pandas.util.testing is deprecated.
FutureWarning:pandas.util.testing 已弃用。 Use the functions in the public API at pandas.testing instead.
请改用 pandas.testing 中公共 API 中的函数。
My packages are up-to-date currently but still get the same error above.我的软件包目前是最新的,但仍然出现上述相同的错误。 It'd be great to hear any advice how am I gonna solve the issue.
很高兴听到任何建议我将如何解决这个问题。
That was depreciated a couple years ago.几年前就贬值了。 Please try it this way.
请尝试这种方式。
import datetime
import pandas as pd
import numpy as np
import pylab as pl
import datetime
from sklearn.cluster import AffinityPropagation
from sklearn import metrics
from matplotlib.collections import LineCollection
from pandas_datareader import data as wb
from sklearn import cluster, covariance, manifold
start = '2019-02-01'
end = '2020-02-01'
tickers = ['MMM',
'ABT',
'ABBV',
'ABMD',
'ACN',
'ATVI']
thelen = len(tickers)
price_data = []
for ticker in tickers:
prices = wb.DataReader(ticker, start = start, end = end, data_source='yahoo')[['Open','Adj Close']]
price_data.append(prices.assign(ticker=ticker)[['ticker', 'Open', 'Adj Close']])
#names = np.reshape(price_data, (len(price_data), 1))
names = pd.concat(price_data)
names.reset_index()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.