How do I set the value for a certain date range in every year e.g 20 March - 15 July? I've tried using the code below to set all values before 20 April to 0 but as you can see it only sets the values before the 20th of each month to 0
idx = pd.date_range(dt.date(2010,1,1) , dt.date(2020,1,1) , freq = 'd')
df = pd.DataFrame(data = np.random.randint(0,5, size=len(idx)),index = idx )
df.loc[(df.index.month <= 4) & (df.index.day <20)] = 0
df.head(50)