与えられた:
from collections import Counter
class TEST:
age = 'unknown'
city = 'unknown'
def __init__(self, a, c):
self.age = a
self.city = c
def __repr__(self):
return "(" + str(self.age) + "," + self.city + ")"
L = [TEST(20, 'LA'), TEST(30, 'NY'), TEST(30, 'LA')]
「都市」属性の頻度を数えたいと思います。
望ましい出力:
[[20, 'LA', 2], [30, 'NY', 1], [30, 'LA', 2]]