title: Convert numbers in millions and thousands to string format
body: <p>I have a column in my pandas dataframe:</p>
  <pre><code>df = pd.DataFrame([[3000000, 2500000, 1800000, 800000, 500000]], columns=['Market value'])
  </code></pre>
  <p>I want to convert the numbers in this column to a format with millions and hundred thousands, for example:</p>
  <ul>
  <li>3000000 -&gt; €3M</li>
  <li>2500000 -&gt; €2.5M</li>
  <li>1800000 -&gt; €1.8M</li>
  <li>800000 -&gt; €800K</li>
  <li>500000 -&gt; €500K</li>
  </ul>
  <p>This is my attempt so far:</p>
  <pre><code>df['Market Value'] = np.select(condlist = [(df['Market value']/1000) &gt;= 1000],
                                 choicelist = ['€'+(df['Market value'].astype(float)/1000000).astype(int).astype(str) + 'M'],
                                 default = '€'+(df['Market value'].astype(float)/1000).astype(int).astype(str) + 'K')
  </code></pre>
  <p>This produces the output:</p>
  <ul>
  <li>3000000 -&gt; €3M</li>
  <li>2500000 -&gt; €2M * <strong>this needs to be €2.5M</strong></li>
  <li>1800000 -&gt; €1M * <strong>this needs to be €1.8M</strong></li>
  <li>800000 -&gt; €800K</li>
  <li>500000 -&gt; €500K</li>
  </ul>