Answers for "how to add multiple strings in contains pandas"

1

pandas multiple string contains

# credit to Stack Overflow user in the source link

>>> df = pd.Series(['cat','hat','dog','fog','pet'])
>>> searchfor = ['og', 'at']
>>> df[df.str.contains('|'.join(searchfor))]

0    cat
1    hat
2    dog
3    fog
dtype: object
Posted by: Guest on May-18-2021
1

pandas dataframe add two columns int and string

df1 = df['1st Column Name'].map(str) + df['2nd Column Name'].map(str) + ...
Posted by: Guest on June-18-2020

Code answers related to "how to add multiple strings in contains pandas"

Python Answers by Framework

Browse Popular Code Answers by Language