title: Clean trailing period if present as last non whitespace of dataframe column
body: <p>Here's a sample of the data I'm working on(first line are the column names):</p>
  <pre><code>DENOMINAZIONE;ATC;PRINCIPIO ATTIVO;TITOLARE;AIC    
  ABASAGLAR;A10AE04;INSULINA GLARGINE;ELI LILLY NEDERLAND B.V.;043658
  ABASRIA;A10AE04;INSULIN GLARGINE;ELI LILLY REGIONAL OPERATIONS GMBH.;043658
   ABECMA;L01;IDECABTAGENE VICLEUCEL;CELGENE EUROPE BV;049604
  ABEVMY;L01XC07;BEVACIZUMAB;MYLAN IRE HEALTHCARE LTD ;049452
  ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD. ;043143
  ABILIFY MAINTENA;N05AX12;ARIPIPRAZOLE;OTSUKA PHARMACEUTICAL EUROPE LTD;043143
  </code></pre>
  <p>and I need to eliminate the last '.' so that for example the last two lines become identical. I also need to take into account that sometimes there are leading or trailing whitespaces, possibly more than one.</p>
  <p>The CSV file is read into a Pandas.DataFrame comp_df on which I tried the following line:</p>
  <pre><code>comp_df.TITOLARE.str.replace(r&quot;.+\.\s*$&quot;, &quot;&quot;, regex=True)
  </code></pre>
  <p>which does its job of matching one or more non whitespace chars followed by a literal period followed by zero or more spaces until the end of line is reached.</p>
  <p>My objective is to lessen the variability of the strings in the TITOLARE series.</p>
  <p>The problem is that the lines that match are correctly substituted but the non matching lines are returned as empty.</p>
  <p>How do I fix this?</p>