API: add level kwarg for Series.any/.all · Issue #8302 · pandas-dev/pandas (original) (raw)

It appears that Series' s.any and s.all methods miss level kwargs, unlike their statistical counterparts like s.sum:

In [4]: s = pd.Series([0,1,2], index=[0,0,1])

In [5]: s.sum(level=0) Out[5]: 0 1 1 2 dtype: int64

In [6]: s.prod(level=0) Out[6]: 0 0 1 2 dtype: int64

In [7]: s.any(level=0)

TypeError Traceback (most recent call last) in () ----> 1 s.any(level=0)

/home/immerrr/sources/pandas/pandas/core/series.pyc in f(self, *args, **kwargs) 74 @Appender(func.doc) 75 def f(self, *args, **kwargs): ---> 76 result = func(self.values, *args, **kwargs) 77 if isinstance(result, (pa.Array, Series)) and result.ndim == 0: 78 # return NumPy type

TypeError: _any() got an unexpected keyword argument 'level'

In [8]: s.all(level=0)

TypeError Traceback (most recent call last) in () ----> 1 s.all(level=0)

/home/immerrr/sources/pandas/pandas/core/series.pyc in f(self, *args, **kwargs) 74 @Appender(func.doc) 75 def f(self, *args, **kwargs): ---> 76 result = func(self.values, *args, **kwargs) 77 if isinstance(result, (pa.Array, Series)) and result.ndim == 0: 78 # return NumPy type

TypeError: _all() got an unexpected keyword argument 'level'

Frames have those and I think so should series. Maybe, there are more reduction methods that I know not of that also miss those...