Using this code as you have used
df.xs('C')['x'] = 9
will not work because that data frame will not get duplicated. You have a different method to do it. That is '.iat', this helps to give a new value for the cell.
Go through the code:
df.at['c','x']=9
OR
df.iat[2,1]=9
Using the above code you can change the cell value in the data frame.
Hear df means data frame, '.iat' locates the cell by an integer and '.at' is locating the cell with the name of the cell.
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch