我有NumPy的列表元素出現2次以上
from collections import Counter
import NumPy as np
a = [ 'abc', 'abc','bca','fdf','dfd','abc','bca','bca']
我用
if Counter (a) > 2:
print (a)
Type Error: '>' not supported between instances of 'Counter' and 'int'
我想輸出是元素的列表數據集中出現的2倍以上。
你有一個列表,不是任何'numpy'數組。 –
你的預期結果*會是什麼?只是一個真實或錯誤的結果,或者你是否必須擁有出現兩次以上的元素? –