0
$\begingroup$

Say I have a list of values and one returns Indeterminate. Is there a way to replace it with say NaN and then keep the rest of the list?

$\endgroup$
2
  • $\begingroup$ Do you want literally the symbol NaN? How is that better than having Indeterminate? Maybe you can tell us what you're trying to achieve and how Indeterminate is interfering with that. $\endgroup$
    – lericr
    Commented Mar 14, 2023 at 16:24
  • $\begingroup$ By "ignore it" do you mean remove it? In that case, DeleteCases[<your list>, Indeterminate] $\endgroup$
    – lericr
    Commented Mar 14, 2023 at 16:37

1 Answer 1

1
$\begingroup$

How you want to do this probably depends on what you want to do with the list later. In Mathematica, Indeterminate is a kind of NaN. But if the intent is to remove the offending value, you can do something like this:

list = {1, 2, 3, 0/0, 4, 5, 6};
blist = list /. Indeterminate -> Nothing

Now blist is {1,2,3,4,5,6}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.