有scipy.signal.argrelextrema函数可以与ndarray一起使用,但是当我尝试在pandas.Series上使用它时,它会返回一个错误.与pandas一起使用它的正确方法是什么?
import numpy as np
import pandas as pd
from scipy.signal import argrelextrema
s = pd.Series(randn(10), range(10))
s
argrelextrema(s, np.greater)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
4 s = pd.Series(randn(10), range(10))
5 s
----> 6 argrelextrema(s, np.greater)
/usr/lib/python2.7/dist-packages/scipy/signal/_peak_finding.pyc in argrelextrema(data, comparator, axis, order, mode)
222 """
223 results = _boolrelextrema(data, comparator,
--> 224 axis, order, mode)
225 return np.where(results)
226
/usr/lib/python2.7/dist-packages/scipy/signal/_peak_finding.pyc in _boolrelextrema(data, comparator, axis, order, mode)
60
61 results = np.ones(data.shape, dtype=bool)
---> 62 main = data.take(locs, axis=axis, mode=mode)
63 for shift in xrange(1, order + 1):
64 plus = data.take(locs + shift, axis=axis, mode=mode)
TypeError: take() got an unexpected keyword argument 'mode'