title: Groupby past date values into a list
body: <p>I have a dataframe like:</p>
  <p><strong>EDIT</strong>: I changed the dataframe to include a more general case of duplicate <code>Date</code>s.</p>
  <pre><code>df = pd.DataFrame({'user':[1,1,1,1,1,2,2], 'Date':['2021-06-13','2021-06-13','2021-06-12','2021-06-12','2021-06-11','2021-06-11','2021-06-10'],'val':[4,5,6,7,8,9,10]})
  df['Date'] =  pd.to_datetime(df.Date, format='%Y-%m-%d')
  
      user    Date    val
  0   1   2021-06-13  4
  1   1   2021-06-13  5
  2   1   2021-06-12  6
  3   1   2021-06-12  7
  4   1   2021-06-11  8
  5   2   2021-06-11  9
  6   2   2021-06-10  10
  </code></pre>
  <p>I would need to:</p>
  <ol>
  <li>Groupby <code>user</code> and within each user:</li>
  <li>Groupby <code>Date</code> within a timeframe (say 1 month) of each row (<strong>EXCLUDING</strong> that row's <code>Date</code>, we want to look at past month)</li>
  <li>bundle the <code>val</code> into a list.</li>
  </ol>
  <p>The desired output would look like:</p>
  <pre><code>    user    Date    val past
  0   1   2021-06-13  4   [6, 7, 8]
  1   1   2021-06-13  5   [6, 7, 8]
  2   1   2021-06-12  6   [8]
  3   1   2021-06-12  7   [8]
  4   1   2021-06-11  8   []
  5   2   2021-06-11  9   [10]
  6   2   2021-06-10  10  []
  </code></pre>
  <p>For example, <code>user=1</code> has <code>val</code>s <code>[6,7,8]</code> in the past month from its <code>Date=2021-06-13</code> and so on.</p>
  <p><strong>EDIT</strong>: please note that there could be duplicate dates (like in example above for <code>Date=2021-06-13</code>), in which case, we still want to bundle <code>val</code>s for ONLY PAST <code>Date</code>s that does not include the current row's <code>Date</code>. For example, 1st and 2nd row both have same past up to <code>Date=2021-06-12</code> and EXCLUDING <code>Date=2021-06-13</code>.</p>
  <p><a href="https://stackoverflow.com/a/45281439/4975981">This answer</a> solves it if the current <code>Date</code> was included, but I need to <strong>EXCLUDE</strong> the row's current date. Of course, one naive solution would be to remove that row's values from the list after groupby but I am looking for something faster since data frame is huge.</p>