Average per day when you have monthly sums¶
Just occasionally I end up with dealing with data representing monthly sums (like sales in £ per month, or similar). To smooth out the fact that different months have different numbers of days, it can be handy to break this down into averages per day.
Assuming you have a DateTimeIndex, this little function in combination with pandas apply
method gets the job done: