简体   繁体   English

select 应用 senti.net 分析的具体评论

[英]select specific reviewes to apply sentimnet analysis

I have a dataset that contains the names of some hotels and a review for each hotel, and I want to apply sentiment analysis on only the top ten repeated hotels in the dataset knowing that the dataset contains around 500 hotels so, how to select the reviews only for the top 10 hotels??我有一个数据集,其中包含一些酒店的名称和每家酒店的评论,我想仅对数据集中前十名重复的酒店应用情绪分析,知道该数据集包含大约 500 家酒店,那么,如何 select 评论仅针对前 10 名酒店?? I tried:我试过:

DF[DF['hotels']==DF['hotels'].value_counts()[:10]]['review']

but it didn't work out, it gave me an error:但它没有成功,它给了我一个错误:

Can only compare identically-labeled Series objects只能比较相同标记的 Series 对象

Any clues??有线索吗??

Rather use isin on the index of your value_counts output, and loc instead of chained slicing to avoid a SettingWithCopyWarning if you later use this sliced Series.而是在value_counts output 的索引上使用isin ,并使用loc而不是链式切片,以避免在以后使用此切片系列时出现SettingWithCopyWarning

out = DF.loc[DF['hotels'].isin(DF['hotels'].value_counts().index[:10]), 'review']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM