字符串str.count(chr)
str1="ACTGATCG"str1.count("A")
列表list:用collections.Counter模块
from collections import Counterimport pandas as pdwordcount = Counter(allwords)wordcount.most_common(10)print(wordcount.most_common(10))df = pd.DataFrame(wordcount.most_common(10),columns=['word', 'count'])print(df)
numpy array
b=a[:,0]np.sum(b=='x')
