Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abhijeet-talaulikar/1c45e87f1433778b7eea4fe4ce8c9a16 to your computer and use it in GitHub Desktop.
Save abhijeet-talaulikar/1c45e87f1433778b7eea4fe4ce8c9a16 to your computer and use it in GitHub Desktop.
if splits == "Q":
time_series = pd.PeriodIndex(dates, freq='Q').astype(str).str[-1].astype(int).values
elif splits == "H":
time_series = pd.PeriodIndex(dates, freq='Q').astype(str).str[-1].map({'1':1, '2':1, '3':2, '4':2}).values
elif splits == "YoY":
time_series = np.array([1]*52 + [2]*52)
else:
time_series = np.arange(104)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment