title: python replace regex match without spaces
body: <p>I basically want to 'join' numbers that should clearly go together. I want to replace the regex match with itself but without any spaces.</p>
  <p>I have:</p>
  <pre><code>df
                 a
  'Fraxiparine 9 500 IU (anti-Xa)/1 ml'
  'Colobreathe 1 662 500 IU inhalačný prášok v tvrdej kapsule'
  </code></pre>
  <p>I want to have:</p>
  <pre><code>df
                 a
  'Fraxiparine 9500 IU (anti-Xa)/1 ml'
  'Colobreathe 1662500 IU inhalačný prášok v tvrdej kapsule'
  </code></pre>
  <p>I'm using <code>r'\d+\s+\d+\s*\d+'</code> to match the numbers, and I've created the following function to remove the spaces within the string:</p>
  <pre><code>def spaces(x):
      match = re.findall(r'\d+\s+\d+\s*\d+', x)
      return match.replace(&quot; &quot;,&quot;&quot;)
  </code></pre>
  <p>Now I'm having trouble applying that function to the full dataframe, but I also don't know exactly how to replace the original match with the string without any spaces.</p>