I have a 6 group of number:
data = np.array([['清新','妩媚'],['英气','温婉'], ['俏皮', '风雅'],
['简洁', '华丽'], ['端庄','风情'], ['清凉','保暖']])
# combination
i = 0
sets = []
while i < 6:
j = i + 1
while j < 6:
g = j + 1
while g < 6:
sets.append([i,j,g])
g += 1
j+=1
i+=1
sets
loop_val_all = [data[i] for i in sets]
fn = lambda x, code=',': reduce(lambda x, y: [str(i) + str(j) for i in x for j in y], x)
combinations = []
for loop_val in loop_val_all:
combinations.append(fn(loop_val))
Each time, I will pick one number from three groups like '清新英气俏皮'. The order is not considered.
So any other idea about how can I return all the combinations using python?
I got 160 sets. I think the result is fine, but my calculation is kind of complex.
['清新英气俏皮',
'清新英气风雅',
'清新温婉俏皮',
'清新温婉风雅',
'妩媚英气俏皮',
'妩媚英气风雅', ...]