Filter values of excel columns to get the required result

Hi All,

I have a excel list as shown bellow,

I want to create a dynamo from this data as bellow. The value in first column should be filter out for same type of Value in column two (first value before type change. can any one suggest a way to do it?
I have managed from excel to filter out the lists expected outcome is in code block

You can use Group.ByKey Node to manage your list.

Assuming all those Id’s are unique, an index/get item combination would work well.

test.dyn (11.5 KB)

I use a similar technique in this video (first technique) to realign excel data by matching Id to corresponding elements, which looks like a task you may also be doing:

Hi @Deniz_Maral Thanks for Reply …

The group by key did worked but faced some issue in it. The Group is combined for all similar type values where as i need all the values where ever type changes. See bellow image for details.

The red marked values should be the taken as per change in type value. but group by key has combined all in to one group. I have used levels and structure too but it didnt resolved the issue.

@GavinCrump Thanks for reply …but sorry i dont think is will resolve the issue.

Oh sorry the description of the issue wasn’t that clear to me.

This is how you can do it Pythonically:

values = IN[0]

indices = []

for n in range(0,len(values)):
	if values[n] != values [n-1]:

OUT = indices

1 Like

@Shy_87 See if this helps:

OUT =  [IN[0][0]] + [x for i,x in enumerate(IN[0][:-1]) if IN[1][i]!=IN[1][i+1]] + [i for i in [IN[0][-1]] if IN[1][-2] != IN[1][-1]]
from itertools import groupby
OUT = [k for k,v in groupby(IN[0])]
1 Like

Thanks @AmolShah this worked perfectly.

1 Like