Skip to main content
Solved

How can I set up a calculation to ignore values equal to 0 when calculating the mean?

  • May 5, 2023
  • 1 reply
  • 63 views

emerson_styles
Contributor
Forum|alt.badge.img+4

I have a shapefile with numerous columns that I need to calculate a mean for on a row by row basis. Within the data there are a lot of values equal to 0 that are skewing the mean - how can I set up a calculation in the ExpressionEvaluator to remove the 0's from my calculation?

Best answer by dustin

Nulls would not be evaluated in that situation, so I would use a NullAttributeMapper prior to the ExpressionEvalutor setting all 0's to <null>. Then after your ExpressionEvaluator, use another NullAttributeMapper to set <null> back to 0's.image

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 627 replies
  • Best Answer
  • May 5, 2023

Nulls would not be evaluated in that situation, so I would use a NullAttributeMapper prior to the ExpressionEvalutor setting all 0's to <null>. Then after your ExpressionEvaluator, use another NullAttributeMapper to set <null> back to 0's.image