replace(x, NaN => 0), (or replace!(x, NaN => 0) if you want to do in-place replacement) should work in many circumstances. Can you post a minimum reproducible example where that does not work?
Please consider the following recommendations to post your example: