I have a list something like this and I want all combinations for two point solution
list1=['a','b','c','d','e','f','g','h']
and I need all 28 combinations from this Expected result:
[['a','b'],['a','c'],['a','d'],['a','e'],['a','f'],['a','g'],['a','h'],
['b','c'],['b','d'],['b','e'],['b','f'],['b','g'],['b','h'],
['c','d'],['c','e'],['c','f'],['c','g'],['c','h'],
['d','e'],['d','f'],['d','g'],['d','h'],
['e','f'],['e','g'],['e','h'],
['f','g'],['f','h'],
['g','h']]
This link is explanation of how 28 combinations. https://www.calculatorsoup.com/calculators/discretemathematics/combinations.php
I have tried scipy
from scipy.special import comb
comb(8, 2, exact=True)
but it is not giving me the actual combination, It is giving me number of possible combination.
itertools is giving me memory error. as in my list df["ID"] there would be more than 1000 elements.
len(list(combinations(df["ID"].to_list(),5)))
If the I want three point solution then possible combination would be 56
Thanks for your help