Stack Exchange
Starting iterrows() loop on a particular index
I'm using iterrows() to do calculations on a dataset that uses a timestamp as its index.  See below as an example:
>>> aapl.head()
Date        Open   High    Low  Close    Volume  Adj Close                                                        
1980-12-12  28.75  28.88  28.75  28.75  16751200       3.15
1980-12-15  27.38  27.38  27.25  27.25   6281600       2.99
1980-12-16  25.38  25.38  25.25  25.25   3776000       2.77
1980-12-17  25.88  26.00  25.88  25.88   3087200       2.84
1980-12-18  26.62  26.75  26.62  26.62   2623200       2.92

I was planning on doing my calculation using for index in aapl.iterrows() but I'm only looking at values within a specific year and the dataset contains much more data than that.  How might I get my loop to start on a particular index value (namely timestamp in this case) and end on another?
Many thanks for any suggestions.

you should show what you are planning on doing operations-wise. looping is generally not a good solution.

You should also be able to just create a subset of that dataframe using the methods here: http://pandas.pydata.org/pandas-docs/dev/timeseries.html#datetime-indexing

Most python iteration functions have an optional start argument. DataFrames don't, but DataFrames are generally much easier to slice into. So I'd suggest slice then iterate:
for row, value in aapl.loc['1980-12-18':].iterrows():
    # do stuff.

What goes into .loc depends on what you want. You may even be able to use .ix[<YEAR>], like .ix['1990'].

Thanks for the response!  That seems like a logical solution but I keep getting the following error:
>>> for row, value in joined.loc['2012-12-18':].iterrows(): ...     print row['Close_NCBC'] Traceback (most recent call last):   File "<pyshell#119>", line 2, in <module>     print row['Close_NCBC'] TypeError: 'Timestamp' object has no attribute '__getitem__'
Anything I might be overlooking?

Don't you want value['Close_NCBC'] ?

@user1827356 Thanks for the response.  Indeed I do; the script above was just to test the proposed solution for running the for-loop at a given starting point.  The error at hand comes from using the timestamp in the loop; the print command doesn't appear be the issue.
