Since map() is applied element-wise, each element (x) is a string- when replace() is called, it is invoking Python's built-in string method, instead of Panda's.
The error is raised because Python's built-in method requires both arguments to be strings.