擅长:python、mysql、java
<p>我会用<a href="https://pandas-datareader.readthedocs.io/en/latest/remote_data.html" rel="nofollow">DataReader</a>来表示:</p>
<pre><code>In [61]: from pandas_datareader.data import DataReader
In [62]: DataReader('AAPL', 'yahoo', '2016-06-25', '2016-06-30')['Adj Close']
Out[62]:
Date
2016-06-27 92.040001
2016-06-28 93.589996
2016-06-29 94.400002
Name: Adj Close, dtype: float64
</code></pre>
<p>实际上,您的代码也可以工作(pandas 0.18.1和pandas_datareader 0.2.1):</p>
<pre><code>In [63]: import pandas_datareader.data as web
In [64]: web.get_data_yahoo('AAPL', '2016-06-25', '2016-06-30')
Out[64]:
Open High Low Close Volume Adj Close
Date
2016-06-27 93.000000 93.050003 91.500000 92.040001 45489600 92.040001
2016-06-28 92.900002 93.660004 92.139999 93.589996 39311500 93.589996
2016-06-29 93.970001 94.550003 93.629997 94.400002 36427800 94.400002
In [65]: web.get_data_yahoo('AAPL', '2016-06-25', '2016-06-30')['Adj Close']
Out[65]:
Date
2016-06-27 92.040001
2016-06-28 93.589996
2016-06-29 94.400002
Name: Adj Close, dtype: float64
</code></pre>