Pass param axis=1
to apply
to iterate row-wise:
In [49]:
df[df.apply(lambda x: x['city'].lower() in x['citylist'], axis=1)]
Out[49]:
city citylist
1 RESTON [reston, herndon]
4 SPRINGFIELD [springfield, west springfield]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.