title: How do I aggregate datetime data by week using isocalendar in python?
body: <p>I would like to aggregate datetime data to a weekly level.  The following works with <code>dt.week</code>, but I receive a warning that <code>dt.week</code> has been deprecated.  I have not had success with isocalendar yet.  What would you recommend?</p>
  <p>Here is an example of the data I would like to aggregate by week:</p>
  <pre><code>import pandas as pd
  times = ['2021-01-28 08:00:00', '2021-01-26 08:00:00', '2021-01-25 08:00:00']
  quantities = [40, 12, 43]
  df = pd.DataFrame({'date':['2021-01-28 08:00:00','2021-01-26 08:00:00','2021-02-25 08:00:00'],
                     'quantity':[40, 12, 43]}) # 52 in one week, 43 in the other week
  df['date'] = pd.to_datetime(df['date'])
  df
  </code></pre>
  <p>The <code>dt.week</code> method works, but throws a warning:</p>
  <pre><code>df['week_num'] = df['date'].dt.week
  df.groupby('week_num').sum('quantity')
  </code></pre>
  <p>Result: <strong>week_num 4</strong> has a <strong>quantity of 52</strong> and <strong>week_num 8</strong> has a <strong>quantity of 43</strong>.</p>
  <p>The warning reads <code>&lt;ipython-input-50-d66026a79596&gt;:1: FutureWarning: Series.dt.weekofyear and Series.dt.week have been deprecated.  Please use Series.dt.isocalendar().week instead. df['week_num'] = df['date'].dt.week</code></p>