作业六: RDD综合练习:更丰富的操作 补交原因:当时电脑在维修,没有交作业。

集合运算练习

union(), intersection(),subtract(), cartesian() 

三、学生课程分数

网盘下载sc.txt文件,通过RDD操作实现以下数据分析:

 

 持久化 stu.cache()

 

 

 总共有多少学生?map(), distinct(), count()

 

 

 开设了多少门课程?

 

 每个学生选修了多少门课?map(), countByKey()

 

 每门课程有多少个学生选?map(), countByValue()

 

 100分的个数

 

 Tom选修了几门课?每门课多少分?filter(), map() RDD

 

 Tom选修了几门课?每门课多少分?map(),lookup()  list

 

 Tom的成绩按分数大小排序。filter(), map(), sortBy()

 

 Tom的平均分。map(),lookup(),mean()

 

 生成(课程,分数)RDD,观察keys(),values()

 

 

每个分数+20平时分。mapValues(func)

计算及格人数

 

 mapValues(func)

 

 map(func)

 

 求每门课的选修人数及所有人的总分。combineByKey(

 

 

 求每门课的选修人数及平均分,精确到2位小数。map(),round()

posted @ 2022-06-03 18:58  蔡念威  阅读(34)  评论(0编辑  收藏  举报