Simplify algebra in Week and SemiMonth offsets
State: closed

This PR is careful to only touch Week-base and SemiMonth-based offsets, i.e. has no overlap with #18263.  It does, however, simplify the algebra such that the end result looks a  lot like 18263.

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Frequency
description: DateOffsets
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=h1) Report
> Merging [#18278](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/69472f9ae9c645a0a5932c7c65b6efbdf66fbb5f?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `95.23%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18278/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18278      +/-   ##
==========================================
- Coverage    91.4%   91.38%   -0.03%     
==========================================
  Files         164      164              
  Lines       49878    49852      -26     
==========================================
- Hits        45590    45555      -35     
- Misses       4288     4297       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.18% <95.23%> (-0.01%)` | :arrow_down: |
| #single | `39.43% <0%> (-0.04%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97.06% <95.23%> (-0.06%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=footer). Last update [69472f9...1b5dbc1](https://codecov.io/gh/pandas-dev/pandas/pull/18278?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

do we have sufficient tests for all of these cases? 
> do we have sufficient tests for all of these cases?

As in #18263, I think so, yes.
> do we have sufficient tests for all of these cases?

Looks like between the three active PRs unifying the `apply` methods, there is one line in `LastWeekOfMonth.apply` that does not currently have coverage.  I'll make sure to hit that in the next follow-up.

Side-note.  I went to check this on codecov by clicking the badge on pandas GH page and the link just goes to the image file for the badge itself.  Looks like all the badges do that.  I doubt that's the intended behavior.
> Side-note. I went to check this on codecov by clicking the badge on pandas GH page and the link just goes to the image file for the badge itself. Looks like all the badges do that. I doubt that's the intended behavio

hmm thought that worked.
thanks!
you can click on the codecov report in the pr to see things FYI