Tricky str value replacement within PANDAS DataFrame
<p><strong>Problem Overview</strong>:</p>

<p>I am attempting to clean stock data loaded from CSV file into Pandas DataFrame. The indexing operation I perform works. If I call <code>print</code>, I can see the values I want are being pulled from the frame. However, when I try to replace the values, as shown in the screenshot, PANDAS ignores my request. Ultimately, I'm just trying to extract a value out of one column and move it to another. The PANDAS documentation suggests using the <code>.replace()</code> method, but that doesn't seem to be working with the operation I'm trying to perform.</p>

<p>Here's a pic of the <a href="https://i.stack.imgur.com/iVfA3.png" rel="nofollow noreferrer">code and data before and after code is run</a>.</p>

<p>And the for loop (as referenced in the pic):</p>

<pre><code>for i, j in zip(all_exchanges['MarketCap'], all_exchanges['MarketCapSym']):
    if 'M' in i: j = j.replace('n/a','M') 
    elif 'B' in i: j = j.replace('n/a','M')
</code></pre>