Get two maximum values from each sub-list

Hello Dynamo Team,
I want to take two maximum values from each sub-list and I have apply following logic, But cant get the right index.

@jacob.small I also try List.SetDifference node but also do not get the solution.

Dynamo file to reproduce?

Can you please brief about it ?

hi

import sys
val=IN[0]
res=[]
sres=[]
for v in val:
    for i,vv in enumerate(v):
        if vv==max(v):
            res.append(i)
    sres.append(res)
    res=[]


OUT = sres

edit:


maybe this track

cordially
christian.stan

Hi @christian.stan,
Actually I have both the “System.Double” Object Type. Does it cause the problem ?
I tried with both method but cant get the solution.


Hi,
try the same calculations. Round on your list and on your extremums. before sending them
Sincerely
christian.stan

Your Python code is works when I have create the same calculations as you.

But not in my workflow…

No solution is goi g to work unless we somehow guess as to your exact situation , or you post a dyn (and if needed .rvt) to recreate the issue.

1 Like

hi, try to see if you have true or false
connect this code block to the output of your surfaces

x[1][1]==x[1][2];

cordially
christian.stan

Hi @jacob.small,
Find the attached files, I have created a group where I’m facing the issue in script.

Surface Area Issue.dyn (25.9 KB)
Demo 1.rvt (6.5 MB)

1 Like

Yes, it gives true value.

Why do you need the index? What are you going to use that for next? There’s probably a better way to filter your data. Are you wanting the two largest numbers or just the first two numbers that share the largest value? Some details are still a little unclear.

I want to apply exterior wall finish after filtering the two major areas of the wall surface.

So assuming that the “two major areas” are just the full length sides of each wall, you really just need the maximum area and then can filter each surface with that value. That’s a much simpler process.

1 Like