I have two dataframes where I am trying to replace substring on level1 of multi index with another substring but this fails
For example I have a dataframe df
Index0 Index1 0 1 2
A BX .2 .3 .9
CX .34 .55 .54
D EX .34 .44 .32
FX .43. .88. .06
I am trying to replace the Index1 substring X by Y so that my result
looks like as follows
Index0 Index1 0 1 2
A BY .2 .3 .9
CY .34 .55 .54
D EY .34 .44 .32
FY .43. .88. .06
I am using the following function
df.replace('X','Y')
however i get the following error
AttributeError Traceback (most recent call last)
<ipython-input-56-fc7014a2d950> in <module>()
8
9
---> 10 df.replace('X','Y')
AttributeError: 'MultiIndex' object has no attribute 'replace'
dflooks like an Index