I have a time series as pandas dataframe, that have one column named "pre". The index of the dataframe is pandas date_range. The dates range from 1998-01-01 to 2002-12-31.
I want to get the sum of pre values from "1998-01-01" to "1998-05-31" plus "1998-09-01" to "1998-12-31". After getting this for the year 1998, how can I get the same for all the years?