title: python3 iterating through dates
body: <p>I have a list of date objects X ("%Y,%m,%d") and a date Y and want to have a list Z with all dates in it that are +-10days away from date Y IGNORING the year.</p>
  
  <pre><code>Ex.: 
  timeDelta = 10days
  X = [2017-10-10, 2014-09-31, 1999-05-10, 1992-10-18]
  Y = 2019-10-05
  Z = MyFunction(X, Y, delta)
  
  
  MyFunction(X,Y, timeDelta):
  for i in range((currentDate-500000),currentDate,10000):  # last 50 years in 1 year steps
       bottomBoundries.append(datetime.strptime(str(i),'%Y%m%d')-timedelta(timeDelta))
       topBoundries.append(datetime.strptime(str(i),'%Y%m%d')+timedelta(timeDelta))
   for i in range(0, pandas.shape[0], 1):
       for j in range(0, len(bottomBoundries) , 1):
              if ((pandas["MESS_DATUM"].iloc[i] &gt; bottomBoundries[j]) &amp; (pandas["MESS_DATUM"].iloc[i] &lt; topBoundries[j])):
                  indices.append(i)
   result = pandas.iloc[indices]
  return result
  </code></pre>
  
  <p>This takes a lot of time and I was wondering how to make it more efficient.</p>