Skip to main content
1 of 4
E. Chan-López
  • 31.3k
  • 3
  • 29
  • 50

Using ReplaceAll as follows:

a = {{{0, 0}, {1, 7}, {2, 0}, {3, 2}, {4, 7}},
     {{0, 0}, {1, 0}, {2, 1}, {3, 2}, {4, 7}}};

a /. x : {_, 0} /; x[[1]] != 0 :> {x[[1]], Na}

(*{{{0, 0}, {1, 7}, {2, Na}, {3, 2}, {4, 7}}, 
 {{0, 0}, {1, Na}, {2, 1}, {3, 2}, {4, 7}}}*)
E. Chan-López
  • 31.3k
  • 3
  • 29
  • 50