It is hard to explain without showing what is going on. It basically appears that when I try to extract the indexes from a dataframe that the last value doesn't come with it.
I am using a pandas dataframe for starters.
My first data frame is
daily_stock_values
SPY AAPL
2011-01-05 123.83 332.57
2011-01-06 123.59 332.30
2011-01-07 123.35 334.68
2011-01-10 123.19 340.99
2011-01-11 123.63 340.18
2011-01-12 124.74 342.95
2011-01-13 124.54 344.20
2011-01-14 125.44 346.99
2011-01-18 125.65 339.19
2011-01-19 124.42 337.39
2011-01-20 124.26 331.26
I get that when I run print daily_stock_values
so my next step is to then get only the SPY values. For this instance it doesn't make a difference but my code is this
daily_spy=daily_stock_values['SPY']
print daily_spy
The result is
daily_spy
2011-01-05 123.83
2011-01-06 123.59
2011-01-07 123.35
2011-01-10 123.19
2011-01-11 123.63
2011-01-12 124.74
2011-01-13 124.54
2011-01-14 125.44
2011-01-18 125.65
2011-01-19 124.42
2011-01-20 124.26
My next step is to then extract just the dates from daily_spy but for whatever reason, I cannot get the last date. Whenever I extract the index values, which are the dates, it pulls everything but the last one. I have tried two methods to get the dates out.
d = [i for i in daily_spy.index.values]
print "d ",d
[numpy.datetime64('2011-01-04T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-05T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-06T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-09T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-10T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-11T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-12T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-13T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-17T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-18T19:00:00.000000000-0500'),
numpy.datetime64('2011-01-19T19:00:00.000000000-0500')]
I am not concerned with the formatting here as much as the fact that 2011-01-20 is not in this list.
I also just did simple for loop and it also doesn't show it either. Any ideas why?