text: Q:
  
  Keep only sentences with a single word in Pandas DataFrame
  
  I have a dataframe for sentiment analysis with columns: PhraseID, Phrase, Rating.
  I'd like to filter the dataframe such as to keep only rows in which the Phrase is made of a single word. The column Phrase contains of course strings.
  
  A:
  
  I would try this.  
  mask = df['Phrase'].str.match(r'\A[\w-]+\Z')
  df[mask]  
  
  Or all in one line would be 
  df[df['Phrase'].str.match(r'\A[\w-]+\Z')]
  
  