Issue
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:
('taxi' in str(data.description)
Solution
It seems that you want Series.str.contains
data.loc[(data.type == 'Movie') & (data.genre == 'Action') & data.description.str.contains('taxi')]
To understand why your code doesn't run check first the output of print(str(data.description))
. What does it produce? What is the output of print('taxi' in str(data.description))
? Do you understand what is happening?
Answered By - Rodalm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.