I have a Python pandas dataframe with daily data that looks like:
Date Open High Low Close Adj Close Volume
0 2009-12-31 31.709999 31.840000 31.299999 31.309999 23.547892 1957700
1 2010-01-04 31.480000 31.840000 31.330000 31.469999 23.668222 3472500
2 2010-01-05 31.549999 31.770000 31.400000 31.639999 23.796082 3458700
3 2010-01-06 31.600000 31.889999 31.430000 31.559999 23.735907 3745800
4 2010-01-07 31.549999 31.700001 31.049999 31.230000 23.487726 7232100
How can I save the first and last entry for every year? If the last entry for a year is let's say October 31st, I would like to keep this one as the last entry for the year.