04 2021 档案

摘要:一、词频统计: 读文本文件生成RDD lines将一行一行的文本分割成单词 words flatmap() lines = sc.textFile("file:///home/hadoop/sparkproject/xiaoshuo.txt")words = lines.flatMap(lambda 阅读全文
posted @ 2021-04-24 18:45 霖叶 阅读(236) 评论(0) 推荐(0)
摘要:学生课程分数案例 总共有多少学生?map(), distinct(), count() 开设了多少门课程? 每个学生选修了多少门课?map(), countByKey() 每门课程有多少个学生选?map(), countByValue() Tom选修了几门课?每门课多少分?filter(), map 阅读全文
posted @ 2021-04-12 20:46 霖叶 阅读(84) 评论(0) 推荐(0)
摘要:一、词频统计: 1.读文本文件生成RDD lines 2.将一行一行的文本分割成单词 words flatmap() 3.全部转换为小写 lower() 4.去掉长度小于3的单词 filter() 5.去掉停用词 6.转换成键值对 map() 7.统计词频 reduceByKey() 二、学生课程分 阅读全文
posted @ 2021-04-03 18:48 霖叶 阅读(81) 评论(0) 推荐(0)