Week Start/End Resamping: WS/WE frequencies
State: closed

This is just some initial work to start the conversation.

 - [ ] closes #7049 
 - [ ] tests added / passed
 - [ ] passes ``git diff upstream/master | flake8 --diff``
 - [ ] whatsnew entry


Labels:
name: Frequency
description: DateOffsets

Comments:
With the above changes, the alias works for my original scenario:

```python
import pandas as pd
df = pd.DataFrame(pd.date_range('2016-02-01', '2016-02-29').rename('dt'))
df['val'] = 1
df.groupby(pd.Grouper(key='dt',freq='WS'))['val'].sum()

dt
2016-02-01    7
2016-02-08    7
2016-02-15    7
2016-02-22    7
2016-02-29    1
Freq: WS-MON, Name: val, dtype: int64
```

as well as OP's:
```python
import pandas as pd
import datetime as dt

daily_daterange = pd.date_range(start=dt.datetime(2013, 1, 31),
                                end=dt.datetime(2013,2,28),
                                freq='B')

daily_dataset = pd.DataFrame({'value' : range(len(daily_daterange))}, index=daily_daterange)

# week begin bound to monday
daily_dataset.resample('WS-MON').mean()
Out[460]: 
            value
2013-01-28    0.5
2013-02-04    4.0
2013-02-11    9.0
2013-02-18   14.0
2013-02-25   18.5

# week end bound to sunday
daily_dataset.resample('W-SUN').mean()
Out[461]: 
            value
2013-02-03    0.5
2013-02-10    4.0
2013-02-17    9.0
2013-02-24   14.0
2013-03-03   18.5
```

However, it raises some questions:
- Should there be a `WeekEnd` and `WeekBegin` offset? if so, how do we keep API compatibility with the existing `Week`?
- Would it be confusing to have `WeekEnd` (would people think it refers to weekends)?
- If there is a `WeekEnd` and `WeekBegin` it seems like they would always require a `weekday` so that we can bind to beginning or end, would the following defaults make sense? `WeekEnd.weekday = 6` and `WeekBegin.weekday = 0`?
- Right now, if you do `pd.Timestamp('2017-02-17') + pd.offsets.Week()` it adds a week (7 days). There is no equivalent for Months or Quarters for example. It seems like it would make sense to have `Week`, `WeekEnd` and `WeekBegin`, but I'm not sure if that would cause confusion.
- How often are people using aliases vs offsets? 
Some initial thoughts:

>Should there be a WeekEnd and WeekBegin offset? if so, how do we keep API compatibility with the >existing Week?

As you note - `Week` is currently playing two roles - `Week()` is a fixed 7 day offset, `Week(weekday=3)` is an anchored offset.  So we could deprecate the latter, in favor of `WeekEnd(weekday=3)`.

>Would it be confusing to have WeekEnd (would people think it refers to weekends)?

Not ideal, but not sure if there's a better name.

>How often are people using aliases vs offsets?

Aliases are likely used more, for ranges and resampling, but at least personally, I use offsets fairly frequently for shifting dates.
```
df['date_plus_1yr'] = df['date'] + pd.DateOffset(years=1)
```


I wonder how often people use something like:

```
df['date_plus_1wk'] = df['date'] + pd.offsets.Week()
```

It seems like `Week` is the only `DateOffset` that offers a 'fixed' offset, but there are no `Year` or `Month` fixed offsets. Would we want to add those as well? (although I don't see much benefit from those when you could do any of that directly with `DateOffset`). I think the `anchored` functionality is more interesting, so `WeekEnd` and `WeekBegin` might work well; and I like the idea of deprecating the 'fixed' use of `Week`.


@aiguofer love to have this, but will need quite a bit of testing. 
Yeah... I haven't had time to get back to this. I'd really like to follow the Boy Scout Rule, but indeed that probably means changing some things, and writing lots of tests.

Hopefully I'll have some time to get back to this in the coming weeks.
closing as stale