我在分析一个包含Twitter API数据的JSON文件。 我想找出在我的数据集中出现多少次哈希标签或特定单词。我可以用得到最常见的鸣叫名单:pyspark:查找包含单词/主题标签的鸣叫数
print(df.groupby('text').count().sort(desc('count')).show())
所以我知道,例如,利物浦是在数据绝对是一个字。
我只想找到“利物浦”一词在我的数据集中出现多少次,这是可能的吗?谢谢
我使用Spark版本1.6.0。
列被命名为
['_corrupt_record', 'contributors', 'coordinates', 'created_at', 'delete',
'entities', 'favorite_count', 'favorited', 'filter_level', 'geo', 'id',
'id_str', 'in_reply_to_screen_name', 'in_reply_to_status_id',
'in_reply_to_status_id_str', 'in_reply_to_user_id', 'in_reply_to_user_id_str',
'lang', 'place', 'possibly_sensitive', 'retweet_count', 'retweeted',
'retweeted_status', 'scopes', 'source', 'text', 'truncated', 'user',
'withheld_in_countries']
你能给更多的细节?你在使用spark 2.0+吗?您是否已经拥有数据框中的数据?你的专栏是什么? – flyingmeatball
@flyingmeatball是的,对不起。我正在使用Spark版本1.6.0。列为['_corrupt_record','贡献者','坐标','created_at','删除','实体','favorite_count','favited','filter_level','geo','id','id_str' ,in_reply_to_status_id,in_reply_to_status_id_str,in_reply_to_user_id,in_reply_to_user_id_str,lang,place,来源','文本','截断','用户','版主'in''_countries'] – MelesMeles