Member-only story
QUICK SUCCESS DATA SCIENCE
Predict Mardi Gras with Python and the Computus Algorithm
How often does Mardi Gras fall on Leap Day?
Although we haven’t lived in New Orleans for decades, my wife still updates our digital calendar for the Mardi Gras event. Recently, she noticed something interesting: in the 2028 leap year, Mardi Gras falls on the leap day, February 29th — a rare alignment of two calendar quirks.
Mardi Gras is tied to Easter Sunday, an annual celebration without a fixed date. Having Mardi Gras fall on the leap day is surely a rare event; but how rare? In this Quick Sucess Data Science project, we’ll use Python to find all the occurrences of Mardi Gras on a leap day over a specified timespan and calculate the probability.
Mastering date manipulation is a valuable skill for data scientists. Whether you’re in finance tracking Federal Reserve meetings or in astronomy predicting planetary conjunctions, understanding how to work with dates programmatically opens up a world of possibilities.
The Computus Algorithm
Mardi Gras is linked to Easter Sunday, celebrated on the first Sunday after the first full moon on or after the spring equinox. As a result, Easter always falls within the range of March 22nd to April…










