Double transpose

I frequently end up having to transpose lists twice at different levels. I keep wondering if I am doing it wrong and if there isn’t a better way than double transposing.

Double Transpose.dyn (37.2 KB)

Can you show the outputs of all of the nodes?

please open the dyn file, that will show probably more. :slight_smile:

I cant seem to find a way to make it with less nodes because the datastructure is nested
but you could do something like this

or you could use python and loop over the lists, it would save you some nodes, and its possible to write a recursive function if you do not know the depth of your nested lists

#Enable Python support and load DesignScript library
import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
#assuming the indices count is always the same
output = [ ]
for idx2, level2 in enumerate(IN[0]):#these are the sublists
sublist = [ ] #a placeholder for our result sublist
for idx1, level1 in enumerate(level2):#these are the items
#make a list for each item and add the item and the corresponding item from IN[1] to it
itemlist = [level1,IN[1][idx2][idx1]]
OUT = output

Thank you I’ll Have a look at it tomorrow.
Some further info: the list structure is important as every highest level of list represents a thing to build.

I like it!