我想按日期计算词频。但我在挣扎。
我想要这些结果
日期字数
2020-07-06[“字1”->3,“字2”->2……]
keyword_f = dict_df.select("createDate","wordcount")
keyword_f = keyword_f.groupby("createDate").agg(flatten(collect_list("wordcount")).alias("keywords"))
keyword_f = keyword_f.withColumn("statistic_type",lit("keyword_f"))
keyword_f.show(100,False)
这是我的密码,我该怎么办?
1条答案
按热度按时间egmofgnx1#
从您的原始Dataframe,这是更好的得到字数。