I have this list:
a = {{{0, 0}, {1, 7}, {2, 0}, {3, 2}, {4, 7}}, {{0, 0}, {1, 0}, {2, 1}, {3, 2}, {4, 7}}}
and I'd like to transform it to this:
a = {{{0, 0}, {1, 7}, {2, Na}, {3, 2}, {4, 7}}, {{0, 0}, {1, Na}, {2, 1}, {3, 2}, {4, 7}}}
ie I'd like to replace every 0 by Na except in the first sub-sub-list of each sub-list.
All I can come up with is:
Part[#, 2 ;; All, All] & /@ a /. 0 -> Na
and it works I get
{{{1, 7}, {2, Na}, {3, 2}, {4, 7}}, {{1, Na}, {2, 1}, {3, 2}, {4, 7}}}
but the modification is not attributed to a
.
How can I do that?
a = Part[#, 2 ;; All, All] & /@ a /. 0 -> Na
or perhaps you intended to modify the original copy ofa
? $\endgroup$