#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd # In[8]: df=pd.DataFrame(data=np.array([['A','A','B','B','B'],['yes','no','yes','no','yes'],[1,1,1,1,1]]).T,columns=['letter','yn','ones']) # In[9]: df # In[11]: df.loc[(df.letter=='A')&df.yn.str.contains('y')] # In[ ]: