Christmas on Sundays
After this year's Christmas being on a Sunday rendered my normal holiday schedule completely disrupted (ok, perhaps negligibly inconvenienced would be more fitting), I wondered what the regularity or patterns of Sunday Christmases there might be. This is what I look for in this mini-post.
import calendar as cal
import datetime as dt
from pandas import pandas as pd, DataFrame
pd.options.display.notebook_repr_html = False
The following few lines give the date and day of week of all the Christmases in the 21st century:
christmas = lambda year: dt.date(year, 12, 25)
ydf = DataFrame({'Yr': range(2000, 2100)})
ydf['Xmas'] = pd.to_datetime(ydf.Yr.map(christmas))
ydf['Xmas_dow'] = ydf.Xmas.dt.strftime('%a')
ydf[:10]
A simple rule of thumb we can see is that the day of week that Christmas falls on increases by one every year, except for leap years where it increases by 2 days.
The following block encodes something like Sunday epochs (Sun_epoch
), where the count is only incremented on the years with a Christmas on a Sunday.
ydf['Sunday'] = ydf.Xmas_dow == 'Sun'
ydf['Sun_epoch'] = ydf.Sunday.cumsum()
ydf[:7]
This enables a quick summary of the intervals, showing a pattern where we'll typically have to wait 5 or 6 years for a Sunday, but occasionally have to wait up to 11 years:
ydf.query('Sun_epoch > 0').groupby('Sun_epoch').Yr.agg(['size', 'min'])
It looks like 2016 began an epoch of Sunday-free Christmases that will last for 6 years, after which we'll have a dry spot of 11 years without the inconvenient Sunday Christmas.
A last thing I'm curious about is the regularity of Christmas occurring on a weekend, which is almost as undesirable for me:
ydf['Weekend'] = ydf.Xmas_dow.isin(['Sat', 'Sun'])
ydf['Wkd_epoch'] = ydf.Weekend.cumsum()
ydf.query('Wkd_epoch > 0').groupby('Wkd_epoch').Yr.agg(['size', 'min'])
As expected, these occur much more frequently, and without the periodic 11-year respite.