Code Sample, a copy-pastable example if possible

>>> df
   e  q  w
0  4  1  2
1  5  2  3
2  6  3  4
3  7  4  5
4  8  5  6
>>> 
>>> def f1(ser):
...     return pd.expanding_max(ser)
... 
>>> def f2(ser):
...     return Series.expanding(ser).max()
... 
>>> df["e"].rolling(min_periods=1,center=False,window=1).apply(func=f1)
0    4.0
1    5.0
2    6.0
3    7.0
4    8.0
Name: e, dtype: float64
>>> df["e"].rolling(min_periods=1,center=False,window=1).apply(func=f2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/window.py", line 1084, in apply
    return super(Rolling, self).apply(func, args=args, kwargs=kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/window.py", line 805, in apply
    center=False)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/window.py", line 740, in _apply
    result = calc(values)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/window.py", line 734, in calc
    return func(x, window, min_periods=self.min_periods)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/window.py", line 802, in f
    kwargs)
  File "/pandas/window.pyx", line 1382, in pandas._window.roll_generic (pandas/window.c:35122)
  File "<stdin>", line 2, in f2
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/generic.py", line 5503, in expanding
    axis = self._get_axis_number(axis)
AttributeError: 'numpy.ndarray' object has no attribute '_get_axis_number'

Problem description

Hi, I'm wondering why expanding_max() can support ndarray, but expanding() can't ? And how can I use expanding in this condition? def f2(ser): ... return Series.expanding(ser).max()

change function f2 to this?

def f2(ser): ... return Series.expanding(Series(ser)).max()

It looks like a little stupid....

Comment From: jreback

.expanding is a method of Series, so you need to give it a Series

Series(arr).expanding().max() but of course you wouldn't do this in a rolling window

pd.expanding_max is deprecated FYI.