I have a list like this:
dttrain = [["sunny","hot","high","false","no"],
["sunny","hot","high","true","no"],
["overcast","hot","high","false","yes"]]
I want to count the frequency by the last index, so for example:
sunnny no = 2 , sunny yes = 0, hot no = 2, hot yes = 1.
I have tried my own code:
c = Counter(x for sublist in dttrain for x in sublist)
But this shows:
Counter({'yes': 9, 'false': 8, 'high': 7, 'normal': 7, 'true': 6, 'mild': 6, 'sunny': 5, 'no': 5, 'rainy': 5, 'hot': 4,'overcast': 4, 'cool': 4})