# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

# # Breaking daily ranges

import pandas as pd
from datetime import timedelta, date

start_date = date(year=2021, month=9, day=1)
end_date = date(year=2021, month=11, day=1)

d1=pd.date_range(start_date, end_date, freq="W-FRI")
d1

d2=pd.date_range(start_date, end_date, freq="W-MON")
d2

ranges=[]
ranges.append((pd.Timestamp(start_date), d1[0]))
for s,e in zip(d2[:-1], d1[1:]):
    ranges.append((s,e))
ranges.append((d2[-1], pd.Timestamp(end_date)))
ranges

# # Breaking hourly ranges

StarcoderdataJupyterScriptsDedupFiltered