Dealing with Infinity

Hi all,

Does anybody have a good method to find infinite values in a table and replace them with a different value, like 0? The last discussion I found in the forum was a few years old and wasn’t really a solution anyway.

1 Like

Hi,
the Math Formula has a function “isInfinite” that returns 1 if a value is +/- infinite and 0 otherwise. You can use following expression to replace infinites with an arbitrary value:

(1 - isInfinite($column$)) * $column$ + isInfinite($column$) * <replacement>

Kind regards
Alexander

6 Likes

It would be nice if the Math Formula node and Column Expressions node handled infinite values the same way. Math Formula replaces them with missing value (?) while Column Expression places them with the infinity sign (∞).

If you use the above expression in the Column Expression node and place with the function missingValue(), the output unfortunately is “NaN”, meaning there is still a discrepancy between the two nodes.

This doesn’t seem like too big of a “quality of life” enhancement, but if you’re modifying large existing workflows, it can be a bother to go back and replace existing expression nodes or add new Math Formula nodes, just so the output is the same. (And can be easily used with the Missing Value node… The above expression may work in some instances, but it is not exactly user friendly.)

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.