Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to apply in condition like 'string' in data['column'] in pandas

I have dataset of Netflix shows. I want to filter the records based on:

data.loc[(data.type=='Movie') & (data.genre=='Action') & ('taxi' in str(data.description))]

There are no syntax errors in the above command however it`s not working as per my assumptions.

The condition that is causing the problem is:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

('taxi' in str(data.description)

>Solution :

Try this:

data.loc[(data.type=='Movie') & (data.genre=='Action') & (data.description.str.contains('taxi')]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading