摘要: 阅读全文
posted @ 2022-08-01 11:17 ohbigshit 阅读(44) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/ohbigshit/p/14549238.html 02.Spark架构与运行流程https://www.cnblogs.com/ohbigshit/p/14854320.html 06.Spark SQL 及其DataFrame的基本操作https: 阅读全文
posted @ 2021-06-06 20:23 ohbigshit 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1.Spark SQL出现的 原因是什么? Spark SQL是Spark用来处理结构化数据的一个模块,它提供了一个叫作Data Frame的编程抽象结构数据模型(即带有Schema信息的RDD),Spark SQL作为分布式SQL查询引擎,让用户可以通过SQL、DataFrame API和Data 阅读全文
posted @ 2021-06-06 00:16 ohbigshit 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1.pandas df 与 spark df的相互转换 df_s=spark.createDataFrame(df_p) df_p=df_s.toPandas() 2. Spark与Pandas中DataFrame对比 http://www.lining0806.com/spark%E4%B8%8E 阅读全文
posted @ 2021-06-06 00:07 ohbigshit 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1.安装启动检查Mysql服务。netstat -tunlp (3306) 2.spark 连接mysql驱动程序。–cp /usr/local/hive/lib/mysql-connector-java-5.1.40-bin.jar /usr/local/spark/jars 3.启动 Mysql 阅读全文
posted @ 2021-06-06 00:05 ohbigshit 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 读学生课程分数文件chapter4-data01.txt,创建DataFrame。 一、用DataFrame的操作完成以下数据分析要求 每个分数+5分。 总共有多少学生? 总共开设了哪些课程? 每个学生选修了多少门课? 每门课程有多少个学生选? 每门课程大于95分的学生人数? Tom选修了几门课?每 阅读全文
posted @ 2021-05-27 09:51 ohbigshit 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 学生课程分数案例 总共有多少学生?map(), distinct(), count() 开设了多少门课程? 每个学生选修了多少门课?map(), countByKey() 每门课程有多少个学生选?map(), countByValue() Tom选修了几门课?每门课多少分?filter(), map 阅读全文
posted @ 2021-04-23 17:23 ohbigshit 阅读(47) 评论(0) 推荐(0) 编辑
摘要: >>> s = txt.lower().split()>>> dd = {}>>> for word in s:... if word not in dd:... dd[word] = 1... else:... dd[word] = dic[word] + 1...>>> ss = sorted( 阅读全文
posted @ 2021-04-22 20:29 ohbigshit 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 一、词频统计: #1.读文本文件生成RDD lines #2.将一行一行的文本分割成单词 words flatmap() #3.全部转换为小写 lower() #4.去掉长度小于3的单词 filter() #5.去掉停用词 #6.转换成键值对 map() 7.统计词频 reduceByKey() 二 阅读全文
posted @ 2021-04-06 21:34 ohbigshit 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 一、filter,map,flatmap练习: 1.读文本文件生成RDD lines 2.将一行一行的文本分割成单词 words 3.全部转换为小写 4.去掉长度小于3的单词 5.去掉停用词 二、groupByKey练习 6.练习一的生成单词键值对 7.对单词进行分组 8.查看分组结果 阅读全文
posted @ 2021-03-31 15:50 ohbigshit 阅读(25) 评论(0) 推荐(0) 编辑