'Point' object has no attribute 'display'是什么意思
时间: 2023-06-23 13:55:57 浏览: 51
这个错误意味着你正在尝试在一个 Point 对象上调用一个名为 `display` 的方法,但是这个对象并没有这个方法。可能的原因是你没有正确地创建 Point 类或者没有在这个类中定义 `display` 方法。
请确保你已经正确地定义了 Point 类,并且在这个类中定义了一个名为 `display` 的实例方法,例如:
```python
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def display(self):
print("({0}, {1})".format(self.x, self.y))
```
如果你已经定义了这个类,并且仍然遇到 `'Point' object has no attribute 'display'` 错误,请检查你是否正确地创建了 Point 对象并正确地调用了 `display` 方法。例如:
```python
p = Point(1, 2)
p.display() # 正确调用 display 方法
```
如果你仍然无法解决问题,请提供更多的代码和错误信息,以便我可以更好地帮助你。
相关问题
list object has no attribute split 是什么意思
这个错误通常发生在尝试使用split()方法来分割一个列表对象时。列表对象是一个有序的集合,它不支持split()方法,因为它不是一个字符串。如果想要对列表对象进行分割操作,需要先将其转换为字符串类型。
'DataFrame' object has no attribute 'predict'是什么意思
很抱歉,您提供的引用中并没有出现 'DataFrame' object has no attribute 'predict' 这个错误信息。但是根据您提供的引用,可以看出在使用DataFrame对象时出现了'flatten'属性不存在和使用Model对象时出现了'predict_classes'属性不存在的问题。这两个错误信息都是因为属性名拼写错误或者版本不兼容导致的。具体解决方法如下:
1. 'DataFrame' object has no attribute 'flatten':这个错误信息提示您的DataFrame对象没有'flatten'属性。正确的属性名应该是'values'。您可以使用df.values.flatten()来展开您的DataFrame对象。
2. 'Model' object has no attribute 'predict_classes':这个错误信息提示您的Model对象没有'predict_classes'属性。正确的属性名应该是'predict'。您可以使用model.predict()来进行预测。
相关推荐
![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)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)