'How to check if any word in a string has special characters and conditions in Pandas

I have a dataframe, where one column contains a tweet. I want to get the rows of this dataframe, where this "tweet" column contains any words that start with "#" and have 2 or more capital letters.

So for example, I want to retreive such rows:

  • I love coding in python. #CodingSession
  • I am not scared of #COVID19 anymore.

However, these would not classify under my conditions:

  • I love coding in python. #Coding #Session
  • I love coding in python. #Codingsession
  • I am not scared of #Covid19 anymore.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source