Closed
Description
The current documentation for rolling.apply states:
func : function
Must produce a single value from an ndarray input if raw=True or a Series if raw=False.
This makes it sound like a series consisting of multiple values can be returned by the apply func. This is not true. The following error results:
Pandas v 0.24.1
samples = roll.apply(lambda x: pd.Series([1]), raw=True)
example = pd.Series(np.random.rand(10000,))
example.rolling(100).apply(lambda x: pd.Series([1,2,3,4]), raw=False)
~/anaconda3/envs/pandas/core/series.py in wrapper(self)
91 return converter(self.iloc[0])
92 raise TypeError("cannot convert the series to "
---> 93 "{0}".format(str(converter)))
94
95 wrapper.__name__ = "__{name}__".format(name=converter.__name__)
TypeError: cannot convert the series to <class 'float'>