Categorical.fillna doesn't validate consistent kwargs (original) (raw)
In [3]: pd.Categorical(['a', 'b']).fillna(value='a', method='ffill') Out[3]: [a, b] Categories (2, object): [a, b]
In [4]: pd.Series(pd.Categorical(['a', 'b'])).fillna(value='a', method='ffill')
ValueError Traceback (most recent call last) in () ----> 1 pd.Series(pd.Categorical(['a', 'b'])).fillna(value='a', method='ffill')
~/sandbox/pandas-ip/pandas/pandas/core/series.py in fillna(self, value, method, axis, inplace, limit, downcast, **kwargs) 2659 axis=axis, inplace=inplace, 2660 limit=limit, downcast=downcast, -> 2661 **kwargs) 2662 2663 @Appender(generic._shared_docs['replace'] % _shared_doc_kwargs)
~/sandbox/pandas-ip/pandas/pandas/core/generic.py in fillna(self, value, method, axis, inplace, limit, downcast) 4745 else: 4746 if method is not None: -> 4747 raise ValueError('cannot specify both a fill method and value') 4748 4749 if len(self._get_axis(axis)) == 0:
ValueError: cannot specify both a fill method and value
Both of these should raise. PR coming shortly.