无法将函数应用于Astropy Bootstrap

时间:2016-06-13 19:05:13

标签: python astropy

将函数应用于bootstrap库中的astropy.stats方法时遇到问题。这是一个最小的例子:

x = np.random.random(10)

f = lambda x: x**2

bootstrap(x, bootfunc=f)

错误是:

ValueError                                Traceback (most recent call last)
<ipython-input-129-0fc2f5a721b2> in <module>()
      3 f = lambda x: x**2
      4 
----> 5 bootstrap(x, bootfunc=f)

/home/gbra/anaconda/envs/astroml/lib/python3.5/site-packages/astropy/stats/funcs.py in bootstrap(data, bootnum, samples, bootfunc)
    956             boot[i] = data[bootarr]
    957         else:
--> 958             boot[i] = bootfunc(data[bootarr])
    959 
    960     return boot

ValueError: setting an array element with a sequence.

如果我将f替换为numpy.mean

我在这里缺少什么?

0 个答案:

没有答案
相关问题