반응형
방법
<Series>.str.contains('A|B')
<DataFrame['colA']>.str.contains('A|B')
예시
>>> series = pd.Series(['cat','hat','dog','fog','pet'])
>>> searchfor = ['og', 'at']
>>> series[series.str.contains('|'.join(searchfor))]
>>> series[series.str.contains('og|at')]
0 cat
1 hat
2 dog
3 fog
dtype: object
반응형
댓글