How to Group Same Value of List in the Pictute…
Thank You
Read up on how to use GroupByKey
GroupByKey return result not like picture
Thank @Bjorn_Keulemans1
liste = IN[0]
from collections import OrderedDict
unique = list(OrderedDict.fromkeys(liste))
output = []
for i in unique:
temp = []
for j in liste:
if j ==i:
temp.append(j)
output.append(temp)
OUT = output
group by key node resolves the job, creating a dictionary by keys as well
@Eng.Minh Try this:
from itertools import groupby
OUT = [list(groups) for keyValue,groups in groupby(IN[0])]
Is the idea to group values that are the same consecutively?
As long as the value is the same it’s in the same list, once it changes you need another list and so on?
Thank @AmolShah , it worked fine.
Yes, it is my idea, i need group to count amount of detector and replace by annotation in the picture
@AmolShah
I like your coding skills,
bcoz i got same solution by writing 20-25 lines of code and you got it in 2 line.