Make some attributes of DateOffset read-only; add tests
State: closed

This PR takes over for #17137.  That PR tried to handle the general case of this issue, but ultimately doing that correctly would require a much more extreme refactoring.

This PR only used a cached version of `_params` when `kwds` is empty.  This special case covers `'M', 'D', 'H', 'min', 'sec', 'ms', 'us', 'ns'` special cases.

I plan to extend this to cover at least the Annual and Quarterly cases, but doing that carefully may take a while, so this can get the ball rolling.


 - [ ] closes #xxxx
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master -u -- "*.py" | flake8 --diff``
 - [ ] whatsnew entry


Labels:
name: Enhancement
name: Performance
description: Memory or execution speed performance

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

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

```diff
@@            Coverage Diff             @@
##           master   #17181      +/-   ##
==========================================
- Coverage   90.99%   90.98%   -0.02%     
==========================================
  Files         162      162              
  Lines       49508    49543      +35     
==========================================
+ Hits        45052    45076      +24     
- Misses       4456     4467      +11
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.76% <96%> (ø)` | :arrow_up: |
| #single | `40.27% <70%> (-0.07%)` | :arrow_down: |

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17181?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/17181?src=pr&el=footer). Last update [929c66f...16e2661](https://codecov.io/gh/pandas-dev/pandas/pull/17181?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17181?src=pr&el=h1) Report
> Merging [#17181](https://codecov.io/gh/pandas-dev/pandas/pull/17181?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7bef6d873b8af5ee0d35ba4b42c8a4775a6b3f24?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `97.22%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17181      +/-   ##
==========================================
- Coverage      91%   90.98%   -0.02%     
==========================================
  Files         162      162              
  Lines       49508    49530      +22     
==========================================
+ Hits        45055    45067      +12     
- Misses       4453     4463      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <97.22%> (ø)` | :arrow_up: |
| #single | `40.27% <88.88%> (-0.06%)` | :arrow_down: |

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17181?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/17181?src=pr&el=footer). Last update [7bef6d8...7690d29](https://codecov.io/gh/pandas-dev/pandas/pull/17181?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Hello @jbrockmendel! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on August 26, 2017 at 19:25 Hours UTC
I've got a much better approach that can be implemented if/when #17274 is merged.  Closing this to be replaced at a later date.