title: How to set values in dataframe to a value before every date in every year
body: <p>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</p>
  <pre><code>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 &lt;= 4) &amp; (df.index.day &lt;20)] = 0
  df.head(50)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/aj4tn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aj4tn.png" alt="enter image description here" /></a></p>