python - Apply multiple string containment filters to pandas dataframe using dictionary

PHOTO EMBED

Tue Dec 13 2022 04:01:03 GMT+0000 (Coordinated Universal Time)

Saved by @lahiruaruna #python

In [69]:
df.apply(lambda x: x.str.contains('|'.join(column_filters[x.name]), case=False))

Out[69]:
  COLUMN_1 COLUMN_2
0     True     True
1     True    False
2    False     True
3    False    False
4    False    False
content_copyCOPY

https://stackoverflow.com/questions/43389163/apply-multiple-string-containment-filters-to-pandas-dataframe-using-dictionary