我有以下顺序的数据
Movie_title views likes genres actor_name director_name
xxc - - 455 - ... Action ... ...
nnj - - - Funny
hhs - - - news
jjs - - - Action
uus - - - ...
yys - - - ...
我只想在体裁列中显示movie_title和“动作”值的视图。喜欢
Movie_title views genres
... Action
... Action
正如Ch3steR在评论中对您所说的那样,您的过滤器是通过检查df.genres ==“ action”。
您可以在此之前做类似的事情
columns = ["movie", "genre"]
df = df[columns]
这将导致由这两列构成的df(如果添加则更多),之后您可以开始过滤流派列