摘要: 大作业: 1.选择使用什么数据,有哪些字段,多大数据量。 数据集:us-counties美新冠数据; 字段:日期(date),县(county),国家、州(state),确诊情况(cases),死亡人数(deaths); 数据量:约15.8w条 2.准备分析哪些问题?(8个以上) (1). 统计美国 阅读全文
posted @ 2021-06-07 21:23 会喷水的海参 阅读(43) 评论(0) 推荐(0) 编辑
摘要: spark连接mysql数据库 安装启动检查Mysql服务。 spark 连接mysql驱动程序。 pyspark \ --jars /usr/local/spark/jars/mysql-connector-java-8.0.25.jar \ --driver-class-path /usr/lo 阅读全文
posted @ 2021-05-28 23:39 会喷水的海参 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 读学生课程分数文件chapter4-data01.txt,创建DataFrame。 url = "file:///usr/local/spark/mycode/rdd/chapter4-data01.txt" rdd = spark.sparkContext.textFile(url).map(la 阅读全文
posted @ 2021-05-18 17:54 会喷水的海参 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1.pandas df 与 spark df的相互转换 import pandas as pd import numpy as np arr = np.arange(9).reshape(-1,3) df_p = pd.DataFrame(arr) arr df_p df_p.columns=['a 阅读全文
posted @ 2021-05-13 22:22 会喷水的海参 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 1.Spark SQL出现的 原因是什么? 由于MapReduce这种计算模型执行效率比较慢,所以Spark SQL的应运而生,它是将Spark SQL转换成RDD,然后提交到集群执行,执行效率非常快,同时Spark SQL也支持从Hive中读取数据。 2.用spark.read 创建DataFra 阅读全文
posted @ 2021-05-10 20:02 会喷水的海参 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 一、词频统计: 读文本文件生成RDD lines lines=sc.textFile("file:///usr/local/spark/mycode/rdd/word.txt") lines.foreach(print) 将一行一行的文本分割成单词 words flatmap() words=lin 阅读全文
posted @ 2021-04-17 19:38 会喷水的海参 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 一、词频统计: 1.读文本文件生成RDD lines lines=sc.textFile("file:///usr/local/spark/mycode/rdd/word.txt") lines.foreach(print) 2.将一行一行的文本分割成单词 words flatmap() words 阅读全文
posted @ 2021-04-05 20:32 会喷水的海参 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 一、filter,map,flatmap练习: 1.读文本文件生成RDD lines lines=sc.textFile("file:///usr/local/spark/mycode/rdd/word.txt") 2.将一行一行的文本分割成单词 words words = lines.flatMa 阅读全文
posted @ 2021-03-29 20:42 会喷水的海参 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1.准备文本文件 从文件创建RDD lines=sc.textFile() 筛选出含某个单词的行 lines.filter() lambda 参数:条件表达式 lines = sc.textFile("file:///usr/local/spark/mycode/rdd/word.txt") lin 阅读全文
posted @ 2021-03-26 19:01 会喷水的海参 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 1. 阐述Hadoop生态系统中,HDFS, MapReduce, Yarn, Hbase及Spark的相互关系,为什么要引入Yarn和Spark。 HDFS HDFS(Hadoop分布式文件系统)源自于Google的GFS论文,发表于2003年10月,HDFS是GFS的实现版。HDFS是Hadoo 阅读全文
posted @ 2021-03-12 17:20 会喷水的海参 阅读(122) 评论(0) 推荐(0) 编辑