This is related but diff from another post
data = {'spike-2': [1,2,3], 'hey spke': [4,5,6], 'spiked-in': [7,8,9], 'no': [10,11,12]}
df = pd.DataFrame(data)
I want to choose columns by names if column name matches MORE than one substring criteria.
I tried to use AND operator ie &
spike_cols = [col for col in df.columns if ('spike') & ('hey') in col]
so that I can precisely get the one column 'hey spike' I also used
dfnew = df.filter(regex='spike'&'hey')
getting error
TypeError: unsupported operand type(s) for &: 'str' and 'str'