Straightforward solution using defaultdict to organize everything
Maintain a dictionary of dictionaries, where each table number is a key and the value is another dictionary with food:count pairs. \n\n\nfrom collections import
Maintain a dictionary of dictionaries, where each table number is a key and the value is another dictionary with food:count pairs. \n\n```\nfrom collections import defaultdict \nclass Solution:\n    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:\n        d = defaultdict(dict)\n        cols, tables, res = set(), set(), []\n        for order in orders:\n            table, food = order[1], order[2]\n            cols.add(food)\n            tables.add(int(table))\n            if food not in d[table]:\n                d[table][food] = 1 \n            else:\n                d[table][food] += 1 \n        tables = sorted(list(tables))\n        cols = sorted(list(cols))\n        cols = ["Table"]+cols\n        res.append(cols)\n        for t in tables:\n            row = [str(t)]\n            for food in cols[1:]:\n                if food in d[str(t)]:\n                    row.append(str(d[str(t)][food]))\n                else:\n                    row.append("0")\n            res.append(row)\n        return res \n```
['Hash Table', 'Python3']