I have a data which contains the following 10 words:
[A,B,C,D,E,F,G,H,I,J]
I have a dataset which contains permutations of these words such as:
- A,B
- A,B,C,D
- E,F,G
- H ... and so on.
Most of the combinations are non-repetitive, but unfortunately, there are some which are repetitive. I want to convert those repetitive combinations such as :
- A,B,C,D,E
- C,A,B,D,E
- D,A,B,C,E and so on.. (for 10 elements, there would be about 9 million repetitive combinations but only 1023 non-repetitive combinations. My data has about 1700, meaning there are some repetitions )
I want to convert all these into only one unique value ( all three elements have the same words, in different order, so convert all three into lets say A,B,C,D,E only) which can be anything but has to hold true for all the values having same words. How to do this using Python?
I was able to generate the unique permutations by using this formula in python:
stuff = ['A','B','C','D','E','F','G','H','I','J']
combinations=list()
for L in range(1, len(stuff)+1):
for subset in itertools.combinations(stuff, L):
print(list(subset))
How do I convert those 1700 into 1023 unique values?