1、启动spark
2、建立RDD:
3、从text中读取,read.text
4、从csv中读取:read.csv
5、从json中读取:read.json
7、RDD与Dataframe的转换
(1)dataframe转换成rdd:
法一:datardd = dataDataframe.rdd
法二:datardd = sc.parallelize(_)
(2)rdd转换成dataframe:
dataDataFrame = spark.createDataFrame(datardd)
原文地址:https://www.cnblogs.com/Lee-yl/p/9759657.html
时间: 2024-10-13 01:23:20