Pandas select discontinuous dataframe date slices?

Viewed 778

I have a pandas DF with datetime index: this select works fine

threeyrs=actdf['01/01/2010':'12/31/2012']

but I'd like to get something like this (to exclude 2010):

threeyrs=actdf['01/01/2009':'12/01/2009','01/01/2011':'12/01/2012']

which gives me "unhashable type" and this gives me a string

threeyrs=actdf['01/01/2009':'12/31/2009'],actdf['01/01/2011':'12/31/2012']

Is there a convenient way? dataFrame looks like

            Units
date    
2000-05-01   3041
2000-06-01   3079
2000-07-01   2455
2000-08-01   2671
2000-09-01   2220
2 Answers
Related