pandas dropping of words in dataframe
<p>I have a sample dataframe that I wish to drop all words and keep the values. </p>

<pre><code>Column1    Column2    Column3    Column4                     Column5
5FQ        1.047      S$55.3     UG44.2 as of 02/Jun/2016    S$8.2 mm
</code></pre>

<p>Is it possible to drop words and keep all the numbers? IE: to get the desired results below:</p>

<pre><code>Column1    Column2    Column3    Column4    Column5
5          1.047      55.3       44.2       8.2
</code></pre>

<p>One way would be to do:</p>

<pre><code>In [212]: df
Out[212]: 
  Column1  Column2 Column3                   Column4   Column5
0     5FQ    1.047  S$55.3  UG44.2 as of 02/Jun/2016  S$8.2 mm

In [213]: df.apply(lambda x: x.astype(str).str.extract(r'(\d+\.?\d*)', expand=True).astype(np.float))
Out[213]: 
   Column1  Column2  Column3  Column4  Column5
0      5.0    1.047     55.3     44.2      8.2
</code></pre>

python regex dataframe