While filtering multiple columns I have seen examples where we could filter Rows using something like this df[df['A'].str.contains("string") | df['B'].str.contains("string")] .
I have multiple files where I want to fetch each file and get only those rows with 'gmail.com' from the column names having 'email' string in them.
So an example header can be like: 'firstname' 'lastname' 'companyname' 'address' 'emailid1' 'emailid2' 'emailid3' ...
The columns emailid1..2..3 have emailids containing gmail.com. I would want to fetch rows where gmail can occur in any one of them.
for file in files:
pdf = pd.read_csv('Reduced/'+file,delimiter = '\t')
emailids = [col for col in pdf.columns if 'email' in col]
# pdf['gmail' in pdf[emailids]]