1

I'm trying to use np.polyfit and I keep getting the error:

TypeError: polyfit() got an unexpected keyword argument 'w'

The documentation on that function clearly mentions this argument so I'm not sure whats going on. I'm using SciPy 0.12.0 and NumPy 1.6.1.

Here's a MWE that returns that error:

import numpy as np

x = np.array([0.0, 1.0, 2.0, 3.0,  4.0,  5.0])
y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0])
weight = np.array([0.2, 0.8, 0.4, 0.6, 0.1, 0.3])

poli = np.polyfit(x, y, 3, w=weight)
4

1 回答 1

3

这是您的 numpy 版本的参考,参数 'w' 仅在以后的版本中引入。

于 2013-11-07T14:48:23.017 回答