Python 100% faster, 2 lines
First get the index ruleIndex of the ruleKey corresponding to the column of items.\nThen, extract the list out of this column ([item[ruleIndex] for item in item
First get the index `ruleIndex` of the `ruleKey` corresponding to the column of `items`.\nThen, extract the list out of this column (`[item[ruleIndex] for item in items]`), compare each element of it with `ruleValue` and sum the resulting list of booleans.\n\n> Upvote if you liked it.\n\n```\nruleIndex = [\'type\', \'color\', \'name\'].index(ruleKey)\nreturn sum(map(lambda x: x == ruleValue, [item[ruleIndex] for item in items]))\n```
['Python']