title: how to use python to convert date to weekly level and use Sunday as week start date?
body: <p>If we use the following way, we can find the Monday as week start date</p>
  
  <pre><code>df['week_start'] = df['myday'].dt.to_period('W').apply(lambda r: r.start_time)
  </code></pre>
  
  <p>The to_period('W') will default to use Monday as week start date. Is there anyway we can revise this function to change it to calculate Sunday as week start date? So every date will convert to the corresponding sunday in order to group by the data into weekly level.</p>
  
  <p>For example 1/1/2017 will still be 1/1/2017, but 1/2/2017 to 1/7/2017 will be convert to 1/1/2017.</p>