【发布时间】:2021-08-18 05:11:36
【问题描述】:
我正在尝试在列 cmets 中的 csv 文件中进行多个关键字搜索。出于某种原因,当我尝试搜索时,我收到此错误消息 'DataFrame' object has no attribute 'description'
例如
table1.csv
id_Acco, user_name, post_time comments
1543603, SameDavie , "2020/09/06" The car in the house
1543595, Johntim, "2020/09/11" You can filter the data
1558245, ACAtesdfgsf , "2020/09/19" if you’re looking at a ship
1558245, TDRtesdfgsf , "2020/09/19" you can filter the table to show
输出
id_Acco, user_name, post_time comments
1543603, SameDavie , "2020/09/06" The car in the house
1543595, Johntim, "2020/09/11" You can filter the data
1558245, TDRtesdfgsf , "2020/09/19" you can filter the table to show
代码
df = pd.read_csv('table1.csv')
df[df.description.str.contains('house| filter | table | car')]
df.to_csv('forum_fraud_date_keyword.csv')
【问题讨论】:
-
很高兴您选择了适合您的答案!也请考虑upvote the answer(现在你有 15 名声望并且应该能够投票)。谢谢!