Pandas use and operator in LOC function
Using query
df.query('ratings < 3 & business_id == @id').review_text.tolist()
["'very bad'", "'passable'"]
You need &
for and
logical operator, because need element-wise and
, see boolean indexing:
id = 'xyz'
mylist=df.loc[(df['ratings'] < 3) & (df['business_id'] == id),'review_text'].values.tolist()
print (mylist)
['very bad', 'passable']