Pandas replace with default value
<p>I have a pandas dataframe I want to replace a certain column conditionally.</p>

<p>eg:</p>

<pre><code>   col

 0 Mr
 1 Miss
 2 Mr
 3 Mrs
 4 Col.
</code></pre>

<p>I want to map them as</p>

<pre><code>{'Mr': 0, 'Mrs': 1, 'Miss': 2}
</code></pre>

<p>If there are other titles now available in the dict then I want them to have a default value of <code>3</code></p>

<p>The above example becomes</p>

<pre><code>   col

 0 0
 1 2
 2 0
 3 1
 4 3
</code></pre>

<p>Can I do this with pandas.replace() without using regex ?</p>