title: Creating a new column if a condition is satisfied in the last N days python pandas
body: <p>I have a dataframe like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>timestamp</th>
  <th>value</th>
  <th>id.</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2020-12-16</td>
  <td>25</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2020-12-17</td>
  <td>45</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2020-12-31</td>
  <td>40</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2021-01-31</td>
  <td>37</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2020-12-15</td>
  <td>12</td>
  <td>2</td>
  </tr>
  <tr>
  <td>2020-12-16</td>
  <td>78.</td>
  <td>2.</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to create a new column <code>outcome</code> which takes a value <code>yes</code> is the <code>id</code> doesn't have any entry for the last 25 days.
  For e.g., this is the expected output</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>timestamp</th>
  <th>value</th>
  <th>id.</th>
  <th>outcome</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2020-12-16</td>
  <td>25</td>
  <td>1</td>
  <td>yes</td>
  </tr>
  <tr>
  <td>2020-12-17</td>
  <td>45</td>
  <td>1</td>
  <td>yes.</td>
  </tr>
  <tr>
  <td>2020-12-31</td>
  <td>40</td>
  <td>1</td>
  <td>yes.</td>
  </tr>
  <tr>
  <td>2021-01-31</td>
  <td>37</td>
  <td>1</td>
  <td>no.</td>
  </tr>
  <tr>
  <td>2020-12-15</td>
  <td>12</td>
  <td>2</td>
  <td>yes.</td>
  </tr>
  <tr>
  <td>2020-12-16</td>
  <td>78.</td>
  <td>2.</td>
  <td>yes.</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>In the above example, we can assume that the start date is <code>2020-12-15</code>. So, our comparisons start after this date for all the <code>id</code>s.
  For <code>id 1</code>, starting from <code>2020-12-15</code>, it has entries in the <code>last 25 days</code> except for <code>2021-01-31</code>. The entry that happened before <code>2021-01-31</code> is on <code>2020-12-31</code> which is <code>&gt; 25 days</code> in this example. So, the <code>outcome</code> variable takes a value <code>no</code>. For the rest of the rows, it is <code>yes</code> because for each of the dates, there's a prior entry that falls within the 25 day difference.</p>
  <p>I am very confused about how to write an algorithm for this.</p>
  <p>I would have to <code>groupby</code> <code>id</code>, <code>order by</code> <code>timestamp</code> and then do <code>rolling</code> something on the <code>timestamp</code> to create the <code>outcome</code> column?</p>
  <p>I am very confused about this and any help will be much appreciated!</p>
  <p>Thanks in advance!</p>