-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
Pandas version 0.6.0
from pandas.io.data import DataReader
import datetime
import matplotlib.pyplot as plt
sp500 = DataReader("SPY", "yahoo", start=datetime.datetime(2005, 1,1))
sp500.info()
sp500["Adj Close"].plot()
plt.show()
<class 'pandas.core.frame.DataFrame'>
Index: 4744 entries, 1993-01-29 00:00:00 to 2011-11-25 00:00:00
Data columns:
Open 4744 non-null values
High 4744 non-null values
Low 4744 non-null values
Close 4744 non-null values
Volume 4744 non-null values
Adj Close 4744 non-null values
dtypes: int64(1), float64(5)
As you can see the index begins at 1993-01-29 despite a user specified start date of 2005-1-1. You can specify any ticker and the start date specified in the DataReader function seems to be ignored.
Comment from Wes below:
The Yahoo API is very unreliable in my experience-- the code currently returns whatever data is returned by the query, so something must have changed recently there. I guess it should truncate to the passed date
range regardless of what is returned.