title: Pandas: how to create a year-week variable?
body: <p>I have a dataframe with datetimes</p>
  
  <pre><code>dates = pd.date_range('9/25/2010', periods=10, freq='D')
  
  df = pd.DataFrame({'col':dates})
  df['col']=pd.to_datetime(df['col'])
  df['dow'] = df.col.dt.dayofweek
  df['week'] = df.col.dt.to_period('W')
  df['week_alt']=df.col.dt.year.astype(str) + '-w' + df.col.dt.week.astype(str)
  
  df
  Out[21]: 
           col  dow                  week  week_alt
  0 2010-09-25    5 2010-09-20/2010-09-26  2010-w38
  1 2010-09-26    6 2010-09-20/2010-09-26  2010-w38
  2 2010-09-27    0 2010-09-27/2010-10-03  2010-w39
  3 2010-09-28    1 2010-09-27/2010-10-03  2010-w39
  4 2010-09-29    2 2010-09-27/2010-10-03  2010-w39
  5 2010-09-30    3 2010-09-27/2010-10-03  2010-w39
  6 2010-10-01    4 2010-09-27/2010-10-03  2010-w39
  7 2010-10-02    5 2010-09-27/2010-10-03  2010-w39
  8 2010-10-03    6 2010-09-27/2010-10-03  2010-w39
  9 2010-10-04    0 2010-10-04/2010-10-10  2010-w40
  </code></pre>
  
  <p>Here you can see that a week starts on <code>Monday</code> and ends on <code>Sunday</code>. </p>
  
  <p>I would like to have control over when a week starts. For instance, if weeks now start on Sunday instead, then  <code>2010-09-26</code> would be <code>2010-w39</code> and <code>2010-10-03</code> be <code>2010-w40</code>. </p>
  
  <p>How can I do that in Pandas?</p>