polyfit()获得了意外的关键字参数"w" [英] polyfit() got an unexpected keyword argument 'w'

查看:99
本文介绍了polyfit()获得了意外的关键字参数"w"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用np.polyfit,但我不断收到错误消息:

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

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

该功能的文档明确提到了这一点论据,所以我不确定发生了什么.我正在使用SciPy 0.12.0NumPy 1.6.1.

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.

这是一个返回该错误的MWE:

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)

推荐答案

这是

This is the reference for your numpy version, the argument 'w' was only introduced in a later version.

这篇关于polyfit()获得了意外的关键字参数"w"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆