API: Validate keyword arguments to fillna
State: closed

Closes https://github.com/pandas-dev/pandas/issues/19682

Labels:
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19684?src=pr&el=h1) Report
> Merging [#19684](https://codecov.io/gh/pandas-dev/pandas/pull/19684?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/aa59954a217c8f856bb0980265520d37b85a80af?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/19684/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/19684?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #19684      +/-   ##
==========================================
+ Coverage   91.61%   91.61%   +<.01%     
==========================================
  Files         150      150              
  Lines       48892    48900       +8     
==========================================
+ Hits        44792    44800       +8     
  Misses       4100     4100
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.99% <100%> (ø)` | :arrow_up: |
| #single | `41.79% <62.5%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19684?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/19684/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `95.93% <100%> (-0.01%)` | :arrow_down: |
| [pandas/util/\_validators.py](https://codecov.io/gh/pandas-dev/pandas/pull/19684/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX3ZhbGlkYXRvcnMucHk=) | `96.8% <100%> (+0.46%)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/19684/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `94.91% <100%> (ø)` | :arrow_up: |

------

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

Merging later today if no objections.
let me look 
I was trying to add a test for `cat.fillna(tuple)`, but apparently, we don't allow it anyway. On master.

```python
In [1]: import pandas as pd

In [2]: pd.Categorical([(1, 2), None]).fillna((1, 2))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-73c5b4ab00c2> in <module>()
----> 1 pd.Categorical([(1, 2), None]).fillna((1, 2))

~/sandbox/pandas-ip/pandas/pandas/util/_decorators.py in wrapper(*args, **kwargs)
    136                 else:
    137                     kwargs[new_arg_name] = new_arg_value
--> 138             return func(*args, **kwargs)
    139         return wrapper
    140     return _deprecate_kwarg

~/sandbox/pandas-ip/pandas/pandas/core/arrays/categorical.py in fillna(self, value, method, limit)
   1664                 raise TypeError('"value" parameter must be a scalar, dict '
   1665                                 'or Series, but you passed a '
-> 1666                                 '"{0}"'.format(type(value).__name__))
   1667
   1668         return self._constructor(values, categories=self.categories,

TypeError: "value" parameter must be a scalar, dict or Series, but you passed a "tuple"
```

I've left the `validate_scalar_dict_value` boolean there, as prep for https://github.com/pandas-dev/pandas/issues/19705, but can remove from here if you want.


thanks @TomAugspurger