In python I used itertools combination to get all unique 5 combinations:
from itertools import combinations
lst = ["a", "b", "c", "d","e"]
combinations_of_5 = list(combinations(lst, 5))
I then have a list of lists that I’ve filtered to only include items from lst. I now need to count the most popular combination found in a list of lists.
lst_of_lsts = [
["e", "d", "c", "b","a"],
["e", "b", "c", "a",,"e"],
["a", "b", "a", "d","b"],
["a", "b", "c", "d","e"],
["e", "d", "c", "b","a"]
]
I thought it would be fairly straight forwards but I’ve been struggling to find a reliable way to do this and ensure the results are accurate. My actual list in much larger and I’d like to know the top 10 most popular combinations found in the list of lists. My thought was to maybe use a sliding window technique and see if any of the combinations exist in there.
any help appreciated.