Skip to content

Instantly share code, notes, and snippets.

@yildizumut

yildizumut/T.py Secret

Last active August 13, 2019 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yildizumut/ce6361df59bb22a030c2db3890d8cb4b to your computer and use it in GitHub Desktop.
Save yildizumut/ce6361df59bb22a030c2db3890d8cb4b to your computer and use it in GitHub Desktop.
Getting the length of prediction time horizon
n_of_wkdays = pd.date_range(start = pd.to_datetime(end_date,
format = "%Y-%m-%d") + pd.Timedelta('1 days'),
end = pd.to_datetime(pred_end_date,
format = "%Y-%m-%d")).to_series(
).map(lambda x:
1 if x.isoweekday() in range(1,6) else 0).sum()
T = n_of_wkdays
print(T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment