Last active
January 5, 2019 21:28
-
-
Save andrhua/5725715611eb204b6aab31be902bb237 to your computer and use it in GitHub Desktop.
breakup date generator
This file contains 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
import datetime | |
import numpy as np | |
from scipy.interpolate import InterpolatedUnivariateSpline | |
if __name__ == '__main__': | |
# days elapsed from meeting to first copulation | |
xi = np.array([2*7, 2*30]) | |
# days elapsed from meeting to breakup | |
yi = np.array([3*7, 6*30]) | |
s = InterpolatedUnivariateSpline(xi, yi, k=xi.shape[0] - 1) | |
meeting_date = datetime.datetime(year=2015, month=12, day=2) | |
tolerance_period = s(3*365) | |
breakup_date = meeting_date + datetime.timedelta(days=int(tolerance_period)) | |
print(breakup_date) | |
# 2026-03-16 00:00:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment