인프런 - 강의/청와대 청원 데이터 시각화

8 - 단어 숫자 세기

개복치 개발자 2020. 3. 2. 04:37

 

import collections

print (collections.Counter(['가', '나', '다', '라', '가', '가']))

print (collections.Counter(['가', '나', '다', '라', '가', '가','가','가자','다']))

for k, v in collections.Counter(['가', '나', '다', '라', '가', '가','가','가자','다']).items() :
    print(k, v)
    
list_a = ['가', '나', '다', '라', '가', '가','사']
list_b = ['가', '나', '다', '라', '가', '가']
list_c = list_a + list_b

print(list_c)

collections.Counter(list_c)

collections.Counter(list_c).most_common(2)