title: How to replace all words in a series with a few specified words in Pandas,Python?
body: <p>I want to essentially find and replace using python.</p>
  
  <p>However, I want to say if a cell contains something, then replace with what I want.</p>
  
  <p>I know</p>
  
  <pre><code>str.replace('safsd','something else')
  </code></pre>
  
  <p>However, I am not sure how to specify how to get rid of EVERYTHING in that cell. Do I use <code>*</code>? I am not too familiar with that in python but I know in the bash shell <code>*</code> references to everything...</p>
  
  <p>I have </p>
  
  <pre><code>df['Description'] 
  </code></pre>
  
  <p>that can contain <code>'optiplex 9010 for classes and research'</code> which I just want to replace with <code>'optiplex 9010'</code>. Or <code>'macbook air 11 with configurations...etc.'</code> and I want simply <code>'macbook air 11'</code></p>
  
  <p>I am aiming for...</p>
  
  <pre><code>if  Df['Description'].str.contains('macbook air 11')
    then Df['Description'].str.replace(' (not sure what I put in here) , 'mabook air 11')
  </code></pre>
  
  <p>Any help/ideas?</p>
  
  <p>Thanks!</p>
  
  <p>**Additional info that may be helfpul...</p>
  
  <p>I am working with thousands of different user inputs. So the 'Descriptions' of what someone has purchased is not going to be the same at all in context, wording, structure, etc. etc.
  I can either manually go into excel and filter by what contains 'optiplex 9010' and then replace everything with a simple description , doing the same for macbooks, etc.</p>
  
  <p>I figured there may be some simpler way using pandas/python .str.contains and .str.replace.</p>
  
  <p>Hope that extra info helps! Let me know </p>