What I want to do
I want to convert values in DataFrame
.
Example
Using dictionary is what I came up with (but didn't succeed). In this example, the key of the dictionary is what I want to change from, while the value of the dictionary is what I want to change to.
import pandas as pd
df = pd.DataFrame([[1, 1, 'A'], [2, 2, 'B'], [3, 3, 'C']], index=['I_1', 'I_2', 'I_3'], columns=['C_1', 'C_2', 'C_3'])
# C_1 C_2 C_3
# I_1 1 1 A
# I_2 2 2 B
# I_3 3 3 C
## dictionary to convert data in column `C_3`
conv = {'A':'D', 'B':'E', 'C':'F'}
## !! DO SOMETHING !!
## Expected output (Values in `C_3` are changed.)
# C_1 C_2 C_3
# I_1 1 1 D
# I_2 2 2 E
# I_3 3 3 F