pandas multiple string contains

Solutions on MaxInterview for pandas multiple string contains by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "pandas multiple string contains"
Charlotte
29 Nov 2020
1# credit to Stack Overflow user in the source link
2
3>>> df = pd.Series(['cat','hat','dog','fog','pet'])
4>>> searchfor = ['og', 'at']
5>>> df[df.str.contains('|'.join(searchfor))]
6
70    cat
81    hat
92    dog
103    fog
11dtype: object