title: Grouping by date range with pandas
body: <p>I am looking to group by two columns: user_id and date; however, if the dates are close enough, I want to be able to consider the two entries part of the same group and group accordingly. Date is m-d-y</p>
  
  <pre><code>user_id     date       val
  1           1-1-17     1
  2           1-1-17     1
  3           1-1-17     1
  1           1-1-17     1
  1           1-2-17     1
  2           1-2-17     1
  2           1-10-17    1
  3           2-1-17     1
  </code></pre>
  
  <p>The grouping would group by user_id and dates +/- 3 days from each other. so the group by summing val would look like:</p>
  
  <pre><code>user_id     date       sum(val)
  1           1-2-17     3
  2           1-2-17     2
  2           1-10-17    1
  3           1-1-17     1
  3           2-1-17     1
  </code></pre>
  
  <p>Any way someone could think of that this could be done (somewhat) easily? I know there are some problematic aspects of this. for example, what to do if the dates string together endlessly with three days apart. but the exact data im using only has 2 values per person..</p>
  
  <p>Thanks!</p>