Hi, I'm trying to calculate the standard deviation of three column fields while ignoring zero (or null) values. I've tired various iterations of the expression code below but keep getting syntax errors.
statistics.stdev(d for d in (!ADFgal_2017_N!,!ADFgal_2018_N!,!ADFgal_2019_N!) if d != 0)
try setting a definition query on the layer first to remove the null or "0" values. You may even have blank values that aren't showing up.
I can setup a definition query to keep only features where ADFgal_2017_N, ADFgal_2018_N, and ADFgal_2019_N are greater than zero but that's not really what I want. If there are greater than zero values in two columns and zero in a third, I want to calculate the standard deviation of the two values ignoring the zero value.