__init__() got an unexpected keyword argument 'randon_state'
时间: 2023-09-24 16:13:18 浏览: 120
这个错误通常是因为你在创建一个对象时,使用了错误的参数名。具体来说,可能是你在创建一个需要 `random_state` 参数的对象时,错误地使用了 `randon_state` 参数名。
因此,你需要检查你的代码,找出哪里出现了这个错误的参数名,然后将其改正为正确的参数名 `random_state`。这样就可以解决这个错误了。
相关问题
__init__() got an unexpected keyword argument
__init__()方法是Python中的一个特殊方法,用于初始化对象的属性。当在创建对象时,传递给__init__()方法的参数与定义的参数不匹配时,就会出现"__init__() got an unexpected keyword argument"的错误。
这个错误通常发生在以下情况下:
1. 定义了一个类,并在__init__()方法中定义了一些参数,但在创建对象时传递了不匹配的参数。
2. 在子类中重写了父类的__init__()方法,并且子类的参数与父类的参数不匹配。
解决这个问题的方法是检查传递给__init__()方法的参数是否与定义的参数一致。确保参数名称和数量都正确,并且没有多余的参数。
TypeError:init_()got an unexpected keyword argument
TypeError:init_()got an unexpected keyword argument是一个类型错误,它表示在调用init_()函数时传入了一个未预期的关键字参数。通常情况下,这种错误是由于函数的定义与调用之间的参数不匹配导致的。
可能的原因有:
1. 函数定义中没有定义该关键字参数。
2. 函数定义中的参数名拼写错误。
3. 函数调用时传入了多余的关键字参数。
要解决这个错误,你可以检查函数的定义和调用,确保参数的名称和数量匹配。如果函数定义中确实没有该参数,你可以考虑修改函数定义或者检查是否传入了正确的参数。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)