'list' object has no attribute 'unique'
时间: 2023-07-23 10:15:03 浏览: 704
python报错: list object has no attribute shape的解决
It seems like you are trying to call the `unique()` method on a list object, but lists in Python do not have a built-in `unique()` method. If you want to remove duplicate elements from a list, you can convert it to a set and then back to a list. Here's an example:
```python
my_list = [1, 2, 3, 2, 4, 1, 5]
unique_list = list(set(my_list))
print(unique_list)
```
This will output `[1, 2, 3, 4, 5]`, which is the list with duplicate elements removed.
阅读全文