Getting a list of suffixes from the company names
<p>I have a data frame df with a column name - Company. Few examples of the company names are: ABC Inc., XYZ Gmbh, PQR Ltd, JKL Limited etc. I want a list of all the suffixes (Inc.,Gmbh, Ltd., Limited etc). Please notice that suffix length is always different. There might be companies without any suffix, for example: Apple. I need a complete list of all suffixes from the all the company names, keeping only unique suffixes in the list.</p>

<p>How do I accomplish this task? </p>

<p>So you want the last word of the Company name, assuming the company has a name more than one word long?</p>

<pre><code>set(name_list[-1] for name_list in map(str.split, company_names) if len(name_list) &gt; 1)
</code></pre>

<p>The <code>[-1]</code> gets the last word.  <code>str.split</code> splits on spaces.  I've never used pandas, so getting <code>company_names</code> might be the hard part of this.</p>

python pandas