In a column risklevels I want to replace Small with 1, Medium with 5 and High with 15. I tried:
dfm.replace({\'risk\':{\'Small\': \'1\'}},{\'risk\':{\'Medium
Looks like OP may have been looking for a one-liner to solve this through consecutive calls to '.str.replace:'
dfm.column = dfm.column.str.replace('Small', '1').str.replace('Medium', '5').str.replace('High', '15')
OP, you were close but just needed to replace your commas with .str.replace and the column call ('risk') in a dictionary format isn't necessary. Just pass the pattern-to-match and replacement-value as arguments to replace.