Replace values in pandas Series with dictionary
<p>I want to replace values in a pandas <code>Series</code> using a dictionary. I'm following @DSM's <a href="https://stackoverflow.com/questions/20250771/remap-values-in-pandas-column-with-a-dict">accepted answer</a> like so:</p>
<pre><code>s = Series(['abc', 'abe', 'abg'])
d = {'b': 'B'}
s.replace(d)
</code></pre>
<p>But this has no effect:</p>
<pre><code>0    abc
1    abe
2    abg
dtype: object
</code></pre>
<p>The <a href="http://nipy.bic.berkeley.edu/nightly/pandas/doc/generated/pandas.Series.replace.html" rel="nofollow noreferrer">documentation</a> explains the required format of the dictionary for <code>DataFrames</code> (i.e. nested dicts with top level keys corresponding to column names) but I can't see anything specific for <code>Series</code>.</p>