-
-
Save jamesmaa/21c4789434b29ae5fc522b0d38414ae6 to your computer and use it in GitHub Desktop.
Raymond Birthday Moving Average
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
birthdays = [date(year=1990+x, month=2, day=18) for x in range(5000)] | |
def avg(birthdays): | |
return float(len(birthdays)) / len([b for b in birthdays if b.weekday() == 6]) | |
moving_avg = [avg(birthdays[:x]) for x in range(1, 5000)] | |
plt.plot(moving_avg) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment