List replace nulls with first item above in list


#1

Hi,

Is it possible to replace all nulls with the first value above:
image
ie 40 to 46 should be Utilities


#2

If you need an ootb solution you can do something like this:


But Python is really your best bet for a quick and easy solution.


#3

I would do it like this:


#4

Using DesignScript:


For Loop in DS - Distances between multiple Points
#5

thanks very much!! I am gonna try that this afternoon.


#6

Hi,

with the help above I made this python script, this one runs on a 2d array

"
OUT = []
collumn = 0
numberofcollumns = 10
list = IN[0]

while collumn < numberofcollumns:
	for i in range(len(list)):
		if list[i][collumn] is None:
			list[i][collumn] = list[i-1][collumn]
	collumn = collumn + 1
OUT = list
";

I definitely want to learn more about python