In [7]: replacers = {1: '1=Y', 0: '0=Y', 2: '2=M'}
In [10]: g.replace(replacers)
Out[10]:
A B C D E F
axis1
A 1=Y 2=M 1=Y 1=Y 1=Y 1=Y
B 0=Y 0=Y 1=Y 0=Y 0=Y 0=Y
C 1=Y 0=Y 0=Y 1=Y 0=Y 0=Y
D 1=Y 0=Y 2=M 0=Y 1=Y 0=Y
E 0=Y 1=Y 1=Y 0=Y 0=Y 0=Y
G 0=Y 0=Y 0=Y 0=Y 0=Y 1=Y
[6 rows x 6 columns]
I'm not sure what your second question means. Perhaps you could give an example with your expected output?