ENH: Add errors parameter to DataFrame.rename
State: closed

- [X] closes #13473
- [x] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Labels:
name: API Design
name: Error Reporting
description: Incorrect or improved errors from pandas
name: DataFrame
description: DataFrame data structure

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25535?src=pr&el=h1) Report
> Merging [#25535](https://codecov.io/gh/pandas-dev/pandas/pull/25535?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/bd49d2f2af5c44d4f96031757743ba83e6b29408?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #25535      +/-   ##
==========================================
+ Coverage   91.75%   91.76%   +<.01%     
==========================================
  Files         173      173              
  Lines       52960    52966       +6     
==========================================
+ Hits        48595    48602       +7     
+ Misses       4365     4364       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.33% <100%> (ø)` | :arrow_up: |
| #single | `41.71% <33.33%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25535?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.85% <ø> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `94.17% <100%> (+0.01%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.66% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25535?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/25535?src=pr&el=footer). Last update [bd49d2f...383bc59](https://codecov.io/gh/pandas-dev/pandas/pull/25535?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/25535?src=pr&el=h1) Report
> Merging [#25535](https://codecov.io/gh/pandas-dev/pandas/pull/25535?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d10bbce349b293e9f753d799cd2ad032d5ec7333?src=pr&el=desc) will **decrease** coverage by `0.48%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #25535      +/-   ##
==========================================
- Coverage   91.75%   91.27%   -0.49%     
==========================================
  Files         173      173              
  Lines       52960    52966       +6     
==========================================
- Hits        48595    48344     -251     
- Misses       4365     4622     +257
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.85% <100%> (-0.49%)` | :arrow_down: |
| #single | `41.71% <33.33%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25535?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.85% <ø> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `93.65% <100%> (-0.51%)` | :arrow_down: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `38.56% <0%> (-33.19%)` | :arrow_down: |
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `90.88% <0%> (-1.41%)` | :arrow_down: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `93.92% <0%> (-0.92%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.63% <0%> (-0.14%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25535/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.66% <0%> (+0.09%)` | :arrow_up: |

------

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

@WillAyd Would you want just one line in the Whatsnew enhancement section, or a whole subsection describing its use?
@WillAyd @TomAugspurger Any other feedback?
@WillAyd Ping; fixed the minor feedback. Would you mind giving me an example of the Subsitute decorator so that I can use it in my followup PR?
Thanks @MaxVanDeursen!