title: Python Pandas error: pandas can only use .str accessor with string values
body: <p>I have a pandas script where I get an excel sheet and put it on a pandas dataframe, then I am looking in this dataframe for a specific word, then I create a mask of 1 and 0 of the df, where I find the word.</p>
  
  <p>I don't have a specific format for the excel sheet so I get all the info as is, and I look for the word and create a mask with this line which produce the error:</p>
  
  <pre><code>mask = np.column_stack([df[col].str.find(word) for col in df.columns.tolist()]).astype(int)
  </code></pre>
  
  <p>this line <strong>sometimes</strong> produce this error:</p>
  
  <blockquote>
    <p>pandas can only use .str accessor with string values, which use
    np.object_ dtype in pandas</p>
  </blockquote>
  
  <p>any idea why and how to make it work?</p>
  
  <p>thank you</p>