我必须一次获取整个数据的百分位数,但是我有几个ids数据,希望有所有ids的单独结果。这是我的代码,在这里我得到一些错误
result_frame.groupby('ID').apply(percentile('rolling_mean', [25]))
我得到以下错误
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-60-87a94290cfde> in <module>()
----> 1 result_frame.groupby('VoyageID').apply(percentile('rolling_mean', [25]))
~/anaconda3/lib/python3.6/site-packages/numpy/lib/function_base.py in percentile(a, q, axis, out, overwrite_input, interpolation, keepdims)
4272 r, k = _ureduce(a, func=_percentile, q=q, axis=axis, out=out,
4273 overwrite_input=overwrite_input,
-> 4274 interpolation=interpolation)
4275 if keepdims:
4276 if q.ndim == 0:
~/anaconda3/lib/python3.6/site-packages/numpy/lib/function_base.py in _ureduce(a, func, **kwargs)
4014 keepdim = [1] * a.ndim
4015
-> 4016 r = func(a, **kwargs)
4017 return r, keepdim
4018
~/anaconda3/lib/python3.6/site-packages/numpy/lib/function_base.py in _percentile(a, q, axis, out, overwrite_input, interpolation, keepdims)
4389 n = np.isnan(ap[-1:, ...])
4390
-> 4391 x1 = take(ap, indices_below, axis=axis) * weights_below
4392 x2 = take(ap, indices_above, axis=axis) * weights_above
4393
TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')