I have a pandas data series with cumulative daily returns for a series:
Date CumReturn 3/31/2017 1 4/3/2017 .99 4/4/2017 .992 ... ... 4/28/2017 1.012 5/1/2017 1.011 ... ... 5/31/2017 1.022 ... ... 6/30/2017 1.033 ... ... I want only the month-end values.
Date CumReturn 4/28/2017 1.012 5/31/2017 1.022 6/30/2017 1.033 Because I want only the month-end values, resampling doesn't work as it aggregates the interim values.
What is the easiest way to get only the month end values as they appear in the original dataframe?
from pandas.tseries.offsets import MonthEnd df['EndOfMonth'] = pd.to_datetime(df['Date'], format="%m/%d/%Y") + MonthEnd(1)where MonthEnd(1) specifies increment one to the next date that's a month end