python - Extract date from Pandas DataFrame -


i want download adjusted close prices , corresponding dates yahoo, can't seem figure out how dates pandas dataframe.

i reading answer this question

from pandas.io.data import datareader datetime import datetime goog = datareader("goog",  "yahoo", datetime(2000,1,1), datetime(2012,1,1)) print goog["adj close"] 

and part works fine; however, need extract dates correspond prices.

for example:

adj_close = np.array(goog["adj close"]) 

gives me 1-d array of adjusted closing prices, looking 1-d array of dates, such that:

date = # do? 

adj_close[0] corresponds date[0]

when do:

>>> goog.keys() index([open, high, low, close, volume, adj close], dtype=object) 

i see none of keys give me similar date, think there has way create array of dates. missing?

you can goog.index stored datetimeindex. series of date, can do

goog.reset_index()['date'] 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -