[Python3] freq table
\n\nclass Solution:\n    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:\n        freq = {} \n        foods = set()\n        \n        for _
\n```\nclass Solution:\n    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:\n        freq = {} \n        foods = set()\n        \n        for _, table, food in orders: \n            freq.setdefault(table, defaultdict(int))[food] += 1\n            foods.add(food)\n        \n        foods = sorted(foods)\n        ans = [["Table"] + foods]\n        for k in sorted(freq, key=int): \n            row = [k]\n            for food in foods: \n                row.append(str(freq[k][food]))\n            ans.append(row)\n        return ans \n```
['Python3']