List replace nulls with first item above in list

Hi,

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

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.

2 Likes

I would do it like this:

4 Likes

Using DesignScript:

4 Likes

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

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